From 68942bbc34591d7a98f6b45d47dd598bf87b2d30 Mon Sep 17 00:00:00 2001 From: Ivan Antunes Date: Fri, 26 Jul 2024 17:23:19 -0300 Subject: [PATCH] fix: Carregamento de Imagem de Welcome Offline --- assets/images/dark/login.svg:Zone.Identifier | 3 - .../images/dark/welcome.svg:Zone.Identifier | 3 - assets/images/light/login.svg:Zone.Identifier | 3 - .../images/light/welcome.svg:Zone.Identifier | 3 - ios/Podfile.lock | 2 +- .../atom_image_svg_theme.dart | 208 ++---------------- .../menu_component/menu_component_widget.dart | 22 +- .../welcome_template_component_widget.dart | 9 +- 8 files changed, 32 insertions(+), 221 deletions(-) delete mode 100644 assets/images/dark/login.svg:Zone.Identifier delete mode 100644 assets/images/dark/welcome.svg:Zone.Identifier delete mode 100644 assets/images/light/login.svg:Zone.Identifier delete mode 100644 assets/images/light/welcome.svg:Zone.Identifier diff --git a/assets/images/dark/login.svg:Zone.Identifier b/assets/images/dark/login.svg:Zone.Identifier deleted file mode 100644 index 1bf0b28e..00000000 --- a/assets/images/dark/login.svg:Zone.Identifier +++ /dev/null @@ -1,3 +0,0 @@ -[ZoneTransfer] -ZoneId=3 -HostUrl=https://github.com/ diff --git a/assets/images/dark/welcome.svg:Zone.Identifier b/assets/images/dark/welcome.svg:Zone.Identifier deleted file mode 100644 index 1bf0b28e..00000000 --- a/assets/images/dark/welcome.svg:Zone.Identifier +++ /dev/null @@ -1,3 +0,0 @@ -[ZoneTransfer] -ZoneId=3 -HostUrl=https://github.com/ diff --git a/assets/images/light/login.svg:Zone.Identifier b/assets/images/light/login.svg:Zone.Identifier deleted file mode 100644 index 1bf0b28e..00000000 --- a/assets/images/light/login.svg:Zone.Identifier +++ /dev/null @@ -1,3 +0,0 @@ -[ZoneTransfer] -ZoneId=3 -HostUrl=https://github.com/ diff --git a/assets/images/light/welcome.svg:Zone.Identifier b/assets/images/light/welcome.svg:Zone.Identifier deleted file mode 100644 index 1bf0b28e..00000000 --- a/assets/images/light/welcome.svg:Zone.Identifier +++ /dev/null @@ -1,3 +0,0 @@ -[ZoneTransfer] -ZoneId=3 -HostUrl=https://github.com/ diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 20609413..dbd080c3 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -311,6 +311,6 @@ SPEC CHECKSUMS: video_player_avfoundation: 7c6c11d8470e1675df7397027218274b6d2360b3 webview_flutter_wkwebview: be0f0d33777f1bfd0c9fdcb594786704dbf65f36 -PODFILE CHECKSUM: f2b7abe080b8e8f49e642b85431f5117d22149fe +PODFILE CHECKSUM: d7f4d1b71f8c708247c1078c4aec33a28c763405 COCOAPODS: 1.15.2 diff --git a/lib/components/atomic_components/shared_components_atoms/atom_image_svg_theme.dart b/lib/components/atomic_components/shared_components_atoms/atom_image_svg_theme.dart index f2173bfd..94484ab5 100644 --- a/lib/components/atomic_components/shared_components_atoms/atom_image_svg_theme.dart +++ b/lib/components/atomic_components/shared_components_atoms/atom_image_svg_theme.dart @@ -1,199 +1,25 @@ import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; -import 'package:google_fonts/google_fonts.dart'; -import 'package:hub/app_state.dart'; -import 'package:hub/flutter_flow/flutter_flow_icon_button.dart'; -import 'package:hub/flutter_flow/flutter_flow_theme.dart'; -import 'package:hub/flutter_flow/internationalization.dart'; -import 'package:hub/flutter_flow/nav/nav.dart'; -import 'package:hub/pages/preferences_settings_page/preferences_settings_model.dart'; -import 'package:provider/provider.dart'; +import 'package:flutter_svg/flutter_svg.dart'; +class AtomImageSvgTheme extends StatelessWidget { + final String filename; + final double width; + final double height; -class PreferencesPageWidget extends StatelessWidget { - const PreferencesPageWidget({super.key}); + const AtomImageSvgTheme({ + super.key, + required this.filename, + required this.width, + required this.height + }); @override Widget build(BuildContext context) { - return ChangeNotifierProvider( - create: (_) => PreferencesPageModel(), - child: Consumer( - builder: (context, model, child) => GestureDetector( - onTap: () => model.unfocusNode.canRequestFocus - ? FocusScope.of(context).requestFocus(model.unfocusNode) - : FocusScope.of(context).unfocus(), - child: Scaffold( - backgroundColor: FlutterFlowTheme.of(context).primaryBackground, - appBar: AppBar( - backgroundColor: FlutterFlowTheme.of(context).primaryBackground, - automaticallyImplyLeading: false, - forceMaterialTransparency: true, - leading: FlutterFlowIconButton( - borderColor: Colors.transparent, - borderRadius: 30.0, - borderWidth: 1.0, - buttonSize: 60.0, - icon: Icon( - Icons.keyboard_arrow_left, - color: FlutterFlowTheme.of(context).primaryText, - size: 30.0, - ), - onPressed: () async { - context.pop(); - }, - ), - title: Text( - FFLocalizations.of(context).getVariableText( - enText: 'Preferences', - ptText: 'Preferências', - ), - style: FlutterFlowTheme.of(context).headlineMedium.override( - fontFamily: 'Nunito', - color: FlutterFlowTheme.of(context).primaryText, - fontSize: 17.0, - letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap().containsKey('Nunito'), - ), - ), - centerTitle: true, - elevation: 0.0, - ), - body: Column( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - mainAxisSize: MainAxisSize.max, - children: [ - Container(), - Expanded( - flex: 2, - child: ListView.builder( - // gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( - // crossAxisCount: 3, - // crossAxisSpacing: 12.0, - // mainAxisSpacing: 12.0, - // childAspectRatio: 1.0, - // mainAxisExtent: 100.0, - // ), - itemCount: 6, // Assuming 4 items for simplicity - padding: const EdgeInsets.symmetric(horizontal: 20.0), - physics: const AlwaysScrollableScrollPhysics(), - itemBuilder: (BuildContext context, int index) { - return _buildIconButton(context, index, model); - }, - ), - ), - ], - ), - ), - ), - ), - ); + final brightness = MediaQuery.of(context).platformBrightness; + final isDarkMode = brightness == Brightness.dark; + final path = "assets/images/${isDarkMode ? "dark" : "light"}/$filename.svg"; + + return SvgPicture.asset(path, width: width, height: height); } - Widget _buildIconButton(BuildContext context, int index, PreferencesPageModel model) { - IconData icon; - Function() onPressed =() => {}; - bool isEnabled; - String content; - - switch (index) { - case 0: - icon = Icons.fingerprint; - onPressed = () => model.toggleFingerprint(context); // Disable if fingerprint is false - isEnabled = FFAppState().fingerprint; - content = FFLocalizations.of(context).getVariableText( - ptText: 'Ative a autenticação por impressão digital para login seguro.', - enText: 'Enable fingerprint authentication for secure login.', - ); - break; - case 1: - icon = Icons.person; - onPressed = () => model.enablePerson(context); - isEnabled = FFAppState().person; - content = FFLocalizations.of(context).getVariableText( - ptText: 'Exibir código de identificação remota', - enText: 'Display remote identification code', - ); - break; - case 2: - icon = Icons.notifications; - onPressed = model.toggleNotify; - isEnabled = FFAppState().notify; - content = FFLocalizations.of(context).getVariableText( - ptText: 'Ative para receber sua notificação de acesso', - enText: 'Enable to receive your access notification', - ); - break; - case 3: - icon = Icons.lock_clock_sharp; - // onLongPress = model.togglePass(context, model); - isEnabled = FFAppState().pass; - content = FFLocalizations.of(context).getVariableText( - ptText: 'Ative para inserir uma credencial de acesso para o QRCode', - enText: 'Enable to enter an access credential for the QRCode', - ); - break; - case 4: - icon = Icons.landscape; - onPressed = model.localLogout; - isEnabled = false; - content = FFLocalizations.of(context).getVariableText( - ptText: 'Ative para se desvincular do local selecionado', - enText: 'Enable to unlink from the selected location', - ); - break; - case 5: - icon = Icons.delete; - onPressed = () => model.deleteAccount(context); - isEnabled = false; - content = FFLocalizations.of(context).getVariableText( - ptText: 'Delete sua conta e todos os dados associados permanentemente.', - enText: 'Delete your account and all associated data permanently.', - ); - break; - default: - throw Exception('Invalid index: $index'); - } - - return Container( - height: 100, - child: GestureDetector( - onTap: index != 3 ? onPressed : () {model.togglePass(context);}, - child: Row( - children: [ - CircleAvatar( - backgroundColor: isEnabled ? FlutterFlowTheme.of(context).primary : FlutterFlowTheme.of(context).alternate, - child: Icon( - icon, - color: isEnabled ? FlutterFlowTheme.of(context).primaryBackground : FlutterFlowTheme.of(context).primary, - // icon: Icon(icon, color: isEnabled ? FlutterFlowTheme.of(context).primaryBackground : FlutterFlowTheme.of(context).primary, size: 40.0), - // onPressed: index != 3 ? onPressed : () {model.togglePass(context);}, - // borderRadius: 20.0, - // borderWidth: 1.0, - // buttonSize: 40.0, - // fillColor: isEnabled ? FlutterFlowTheme.of(context).primary : FlutterFlowTheme.of(context).alternate, - // disabledColor: FlutterFlowTheme.of(context).alternate, - // disabledIconColor: FlutterFlowTheme.of(context).primary, - ), - ), - SizedBox(width: 8.0), - Expanded( - child: Text( - content, - style: FlutterFlowTheme.of(context).bodySmall.override( - fontFamily: 'Nunito', - color: FlutterFlowTheme.of(context).primaryText, - fontSize: 14.0, - letterSpacing: 0.0, - fontWeight: FontWeight.normal, - fontStyle: FontStyle.normal, - ), - overflow: TextOverflow.clip, - ), - ), - ], - ), - ), - ); - } -} \ No newline at end of file +} diff --git a/lib/components/organism_components/menu_component/menu_component_widget.dart b/lib/components/organism_components/menu_component/menu_component_widget.dart index bbe0830f..5839264c 100644 --- a/lib/components/organism_components/menu_component/menu_component_widget.dart +++ b/lib/components/organism_components/menu_component/menu_component_widget.dart @@ -58,35 +58,35 @@ class _MenuComponentWidgetState extends State { Widget build(BuildContext context) { final options = widget.item == MenuItem.button ? [ - MenuButtonWidget(icon: FFIcons.kvector1, action: () async { await _model.scheduleVisitOptAction(context);setState(() {});}, title: FFLocalizations.of(context).getVariableText(enText:'Schedule\nVisit' , ptText:'Agendar/Visita' ,),), + MenuButtonWidget(icon: FFIcons.kvector1, action: () async { await _model.scheduleVisitOptAction(context);setState(() {});}, title: FFLocalizations.of(context).getVariableText(enText:'Schedule\nVisit' , ptText:'Agendar\nVisita' ,),), - MenuButtonWidget(icon: FFIcons.khome, action: () async {await _model.registerVisitorOptAction(context); setState(() {});}, title: FFLocalizations.of(context).getVariableText(enText:'Register\nVisitor' , ptText:'Cadastro de Visitante' ,),), + MenuButtonWidget(icon: FFIcons.khome, action: () async {await _model.registerVisitorOptAction(context); setState(() {});}, title: FFLocalizations.of(context).getVariableText(enText:'Register\nVisitor' , ptText:'Cadastro\nde Visitante' ,),), // MenuButtonWidget(icon: FFIcons.kvector2, action: () async {setState(() {});}, title: FFLocalizations.of(context).getVariableText(enText:'Link\nCondominum' , ptText:'' ,),), // MenuButtonWidget(icon: FFIcons.kpets, action: () async {setState(() {});}, title: FFLocalizations.of(context).getVariableText(enText:'Register\Pet' , ptText:'' ,),), - MenuButtonWidget(icon: Icons.qr_code, action: () async {await _model.accessQRCodeOptAction(context); setState(() {});}, title: FFLocalizations.of(context).getVariableText(enText:'QRCode\nAccess' , ptText:'' ,),), + MenuButtonWidget(icon: Icons.qr_code, action: () async {await _model.accessQRCodeOptAction(context); setState(() {});}, title: FFLocalizations.of(context).getVariableText(enText:'QRCode\nAccess' , ptText:'QRCode\nde Acesso' ,),), - MenuButtonWidget(icon: Icons.people, action: () async {await _model.peopleOnThePropertyAction(context); setState(() {});}, title: FFLocalizations.of(context).getVariableText(enText:'Poeple on\nthe Property' , ptText:'' ,),), + MenuButtonWidget(icon: Icons.people, action: () async {await _model.peopleOnThePropertyAction(context); setState(() {});}, title: FFLocalizations.of(context).getVariableText(enText:'Poeple on\nthe Property' , ptText:'Pessoas na\nPropriedade' ,),), - MenuButtonWidget(icon: Icons.history_sharp, action: () async {await _model.liberationHistoryOptAction(context);setState(() {});}, title: FFLocalizations.of(context).getVariableText(enText:'Consult\nHistories' , ptText:'' ,),), + MenuButtonWidget(icon: Icons.history_sharp, action: () async {await _model.liberationHistoryOptAction(context);setState(() {});}, title: FFLocalizations.of(context).getVariableText(enText:'Consult\nHistories' , ptText:'Consultar\nHistóricos' ,),), - MenuButtonWidget(icon: Icons.settings, action: () async {await _model.preferencesSettings(context);setState(() {});}, title: FFLocalizations.of(context).getVariableText(enText:'Preferences\nSettings' , ptText:'' ,),), + MenuButtonWidget(icon: Icons.settings, action: () async {await _model.preferencesSettings(context);setState(() {});}, title: FFLocalizations.of(context).getVariableText(enText:'Preferences\nSettings' , ptText:'Configurações' ,),), ] : [ - MenuCardItem(icon: FFIcons.kvector1, action: () async { await _model.scheduleVisitOptAction(context);setState(() {});}, title: FFLocalizations.of(context).getVariableText(enText:'Schedule Visit' , ptText:'Agendar/Visita' ,),), + MenuCardItem(icon: FFIcons.kvector1, action: () async { await _model.scheduleVisitOptAction(context);setState(() {});}, title: FFLocalizations.of(context).getVariableText(enText:'Schedule Visit' , ptText:'Agendar\nVisita' ,),), MenuCardItem(icon: FFIcons.khome, action: () async {await _model.registerVisitorOptAction(context); setState(() {});}, title: FFLocalizations.of(context).getVariableText(enText:'Register Visitor' , ptText:'Cadastro de Visitante' ,),), // MenuCardItem(icon: FFIcons.kvector2, action: () async {setState(() {});}, title: FFLocalizations.of(context).getVariableText(enText:'Link Condominum' , ptText:'' ,),), // MenuCardItem(icon: FFIcons.kpets, action: () async {setState(() {});}, title: FFLocalizations.of(context).getVariableText(enText:'Register\Pet' , ptText:'' ,),), - MenuCardItem(icon: Icons.qr_code, action: () async {await _model.accessQRCodeOptAction(context); setState(() {});}, title: FFLocalizations.of(context).getVariableText(enText:'QRCode Access' , ptText:'' ,),), + MenuCardItem(icon: Icons.qr_code, action: () async {await _model.accessQRCodeOptAction(context); setState(() {});}, title: FFLocalizations.of(context).getVariableText(enText:'QRCode Access' , ptText:'QRCode de Acesso' ,),), - MenuCardItem(icon: Icons.people, action: () async {await _model.peopleOnThePropertyAction(context); setState(() {});}, title: FFLocalizations.of(context).getVariableText(enText:'Poeple on the Property' , ptText:'' ,),), + MenuCardItem(icon: Icons.people, action: () async {await _model.peopleOnThePropertyAction(context); setState(() {});}, title: FFLocalizations.of(context).getVariableText(enText:'Poeple on the Property' , ptText:'Pessoas na Propriedade' ,),), - MenuCardItem(icon: Icons.history_sharp, action: () async {await _model.liberationHistoryOptAction(context);setState(() {});}, title: FFLocalizations.of(context).getVariableText(enText:'Consult Histories' , ptText:'' ,),), + MenuCardItem(icon: Icons.history_sharp, action: () async {await _model.liberationHistoryOptAction(context);setState(() {});}, title: FFLocalizations.of(context).getVariableText(enText:'Consult Histories' , ptText:'Consultar Historicos' ,),), - MenuCardItem(icon: Icons.settings, action: () async {await _model.preferencesSettings(context);setState(() {});}, title: FFLocalizations.of(context).getVariableText(enText:'Preferences Settings' , ptText:'' ,),), + MenuCardItem(icon: Icons.settings, action: () async {await _model.preferencesSettings(context);setState(() {});}, title: FFLocalizations.of(context).getVariableText(enText:'Preferences Settings' , ptText:'Configurações' ,),), ]; return Padding( diff --git a/lib/components/templates_components/welcome_template_component/welcome_template_component_widget.dart b/lib/components/templates_components/welcome_template_component/welcome_template_component_widget.dart index bdb465b1..e0b97fe2 100644 --- a/lib/components/templates_components/welcome_template_component/welcome_template_component_widget.dart +++ b/lib/components/templates_components/welcome_template_component/welcome_template_component_widget.dart @@ -1,3 +1,5 @@ +import 'package:hub/components/atomic_components/shared_components_atoms/atom_image_svg_theme.dart'; + import '/flutter_flow/flutter_flow_animations.dart'; import '/flutter_flow/flutter_flow_theme.dart'; import '/flutter_flow/flutter_flow_util.dart'; @@ -164,12 +166,7 @@ class _WelcomeTemplateComponentWidgetState decoration: const BoxDecoration(), child: ClipRRect( borderRadius: BorderRadius.circular(0.0), - child: SvgPicture.network( - 'https://storage.googleapis.com/flutterflow-io-6f20.appspot.com/projects/flutter-freaccess-hub-0xgz9q/assets/lv1waa0etd3j/undraw_appreciate_it_re_yc8h_(1)_1.svg', - width: 603.0, - height: double.infinity, - fit: BoxFit.contain, - ), + child: const AtomImageSvgTheme(filename: 'welcome', width: 600, height: double.infinity), ), ), Align(