Merge pull request #75 from FRE-Informatica/feat/fd-1035

FEAT/FD-1035 - Tela de Sobre no App
This commit is contained in:
Ivan Antunes 2024-12-11 16:59:37 -03:00 committed by GitHub
commit ff216f63c4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
12 changed files with 224 additions and 34 deletions

View File

@ -24,3 +24,7 @@
-keep class com.google.gson.reflect.TypeToken { *; }
-keep class com.google.common.reflect.TypeToken { *; }
# Additional keep rules to prevent R8 from removing necessary classes
-dontwarn com.google.j2objc.annotations.ReflectionSupport
-keep class com.google.j2objc.annotations.ReflectionSupport { *; }

View File

@ -24,3 +24,6 @@
-keep class com.google.gson.reflect.TypeToken { *; }
-keep class com.google.common.reflect.TypeToken { *; }
# Additional keep rules to prevent R8 from removing necessary classes
-dontwarn com.google.j2objc.annotations.ReflectionSupport
-keep class com.google.j2objc.annotations.ReflectionSupport { *; }

BIN
assets/images/fre.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

View File

@ -0,0 +1,155 @@
import 'dart:developer';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.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/flutter_flow_util.dart';
import 'package:hub/flutter_flow/internationalization.dart';
import 'package:package_info_plus/package_info_plus.dart';
import 'package:url_launcher/url_launcher.dart';
class AboutSystemPage extends StatefulWidget {
@override
_AboutSystemPageState createState() => _AboutSystemPageState();
}
class _AboutSystemPageState extends State<AboutSystemPage> {
String _appVersion = '';
@override
void initState() {
super.initState();
_loadAppVersion();
}
Future<void> _loadAppVersion() async {
try {
final PackageInfo packageInfo = await PackageInfo.fromPlatform();
setState(() {
_appVersion = FFLocalizations.of(context).getVariableText(
ptText: 'Versão do Aplicativo: ${packageInfo.version}',
enText: 'App Version: ${packageInfo.version}',
);
});
} catch (e, s) {
log(e.toString(), stackTrace: s);
setState(() {
_appVersion = FFLocalizations.of(context).getVariableText(
ptText: 'Versão do Aplicativo Indisponível',
enText: 'App Version Unavailable',
);
});
}
}
@override
Widget build(BuildContext context) {
final theme = FlutterFlowTheme.of(context);
return Scaffold(
backgroundColor: theme.primaryBackground,
appBar: _buildAppBar(context, theme),
body: _buildBody(),
);
}
PreferredSizeWidget _buildAppBar(BuildContext context, FlutterFlowTheme theme) {
return AppBar(
backgroundColor: theme.primaryBackground,
automaticallyImplyLeading: false,
leading: _buildBackButton(context, theme),
title: _buildTitle(context, theme),
centerTitle: true,
elevation: 0.0,
);
}
Widget _buildBackButton(BuildContext context, FlutterFlowTheme theme) {
return FlutterFlowIconButton(
borderColor: Colors.transparent,
borderRadius: 30.0,
borderWidth: 1.0,
buttonSize: 60.0,
icon: Icon(
Icons.keyboard_arrow_left,
color: theme.primaryText,
size: 30.0,
),
onPressed: () => Navigator.of(context).pop(),
);
}
Widget _buildTitle(BuildContext context, FlutterFlowTheme theme) {
return Text(
FFLocalizations.of(context).getVariableText(
ptText: 'Sobre o Sistema',
enText: 'About the System',
),
style: theme.headlineMedium.override(
fontFamily: theme.headlineMediumFamily,
color: theme.primaryText,
fontSize: 16.0,
letterSpacing: 0.0,
useGoogleFonts: GoogleFonts.asMap().containsKey(theme.headlineMediumFamily),
),
);
}
Future<void> _launchURL() async {
final Uri url = Uri.parse('https://fre.com.br/');
if (!await launchUrl(url)) {
throw Exception('Could not launch $url');
}
}
Widget _buildBody() {
return Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
SizedBox(height: 20),
_buildLogo(),
SizedBox(height: 20),
_buildAppVersionText(),
Spacer(),
_buildLaunch(),
SizedBox(height: 20),
],
),
);
}
Widget _buildLogo() {
return SizedBox(
height: 50,
width: 50,
child: Image.asset('assets/images/fre.png'),
);
}
Widget _buildLaunch() {
final theme = FlutterFlowTheme.of(context).primary;
return RichText(
text: TextSpan(
text: 'Website',
style: TextStyle(color: theme, fontSize: 16),
recognizer: TapGestureRecognizer()..onTap = () => _launchURL(),
),
);
}
Widget _buildAppVersionText() {
final theme = FlutterFlowTheme.of(context);
return Text(
_appVersion,
style: theme.headlineMedium.override(
fontFamily: theme.headlineMediumFamily,
color: theme.primaryText,
fontSize: 16.0,
letterSpacing: 0.0,
useGoogleFonts: GoogleFonts.asMap().containsKey(theme.headlineMediumFamily),
),
);
}
}

View File

@ -1 +1,2 @@
export 'about_system.dart';
export 'home_page.dart';

View File

@ -148,6 +148,11 @@ GoRouter createRouter(AppStateNotifier appStateNotifier) {
token: token,
);
}),
FFRoute(
name: 'aboutSystemPage',
path: '/aboutSystemPage',
builder: (context, params) => AboutSystemPage(),
),
FFRoute(
name: 'homePage',
path: '/homePage',

View File

@ -9,6 +9,7 @@ import 'package:hub/shared/components/molecules/locals/index.dart';
import 'package:hub/shared/helpers/storage/base_storage.dart';
import 'package:hub/shared/helpers/storage/storage_helper.dart';
import 'package:hub/shared/services/authentication/authentication_service.dart';
import 'package:hub/shared/utils/path_util.dart';
import 'package:share_plus/share_plus.dart';
import '../../shared/utils/snackbar_util.dart';
@ -238,18 +239,8 @@ class PreferencesPageModel with ChangeNotifier {
showAlertDialog(context, title, content, onConfirm);
}
void logout(BuildContext context) async {
final String title = FFLocalizations.of(context).getVariableText(
enText: 'Logout',
ptText: 'Sair',
);
final String content = FFLocalizations.of(context).getVariableText(
enText: 'Are you sure you want to logout?',
ptText: 'Tem certeza que deseja sair?',
);
onConfirm() async => AuthenticationService.signOut(context);
showAlertDialog(context, title, content, onConfirm);
void navAboutSystem(BuildContext context) async {
PathUtil.nav('/aboutSystemPage');
}
void localUnlink(BuildContext context) {

View File

@ -29,9 +29,7 @@ class _PreferencesPageWidgetState extends State<PreferencesPageWidget> {
create: (_) => PreferencesPageModel(),
child: Consumer<PreferencesPageModel>(
builder: (context, model, child) => GestureDetector(
onTap: () => model.unfocusNode.canRequestFocus
? FocusScope.of(context).requestFocus(model.unfocusNode)
: FocusScope.of(context).unfocus(),
onTap: () => model.unfocusNode.canRequestFocus ? FocusScope.of(context).requestFocus(model.unfocusNode) : FocusScope.of(context).unfocus(),
child: Scaffold(
backgroundColor: FlutterFlowTheme.of(context).primaryBackground,
appBar: AppBar(
@ -77,7 +75,7 @@ class _PreferencesPageWidgetState extends State<PreferencesPageWidget> {
Expanded(
flex: 2,
child: ListView.builder(
itemCount: 8,
itemCount: 9,
padding: const EdgeInsets.symmetric(horizontal: 20.0),
physics: const AlwaysScrollableScrollPhysics(),
itemBuilder: (BuildContext context, int index) {
@ -175,12 +173,12 @@ class _PreferencesPageWidgetState extends State<PreferencesPageWidget> {
);
break;
case 8:
icon = Icons.logout;
onPressed = () => model.logout(context);
icon = Icons.info_outline;
onPressed = () => model.navAboutSystem(context);
isEnabled = false;
content = FFLocalizations.of(context).getVariableText(
ptText: 'Sair da conta',
enText: 'Logout',
ptText: 'Sobre o Sistema',
enText: 'About the System',
);
break;
default:
@ -205,12 +203,10 @@ class _PreferencesPageWidgetState extends State<PreferencesPageWidget> {
child: Row(
children: [
CircleAvatar(
backgroundColor:
isEnabled ? FlutterFlowTheme.of(context).primary : FlutterFlowTheme.of(context).alternate,
backgroundColor: isEnabled ? FlutterFlowTheme.of(context).primary : FlutterFlowTheme.of(context).alternate,
child: Icon(
icon,
color:
isEnabled ? FlutterFlowTheme.of(context).primaryBackground : FlutterFlowTheme.of(context).primary,
color: isEnabled ? FlutterFlowTheme.of(context).primaryBackground : FlutterFlowTheme.of(context).primary,
),
),
const SizedBox(width: 8.0),

View File

@ -218,6 +218,16 @@ class MenuEntry implements BaseModule {
route: '/preferencesSettings',
types: [MenuEntryType.Home, MenuEntryType.Drawer],
),
MenuEntry(
key: 'FRE-HUB-ABOUT-SYSTEM',
icon: Icons.info_outline,
name: FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
ptText: 'Sobre o Sistema',
enText: 'About the System',
),
route: '/aboutSystemPage',
types: [MenuEntryType.Drawer],
),
MenuEntry(
key: 'FRE-HUB-LOGOUT',
icon: Icons.exit_to_app,

View File

@ -12,6 +12,7 @@ enum LicenseKeys {
openedVisits('FRE-HUB-OPENED-VISITS'),
vehicles('FRE-HUB-VEHICLES'),
residents('FRE-HUB-RESIDENTS'),
about('FRE-HUB-ABOUT-SYSTEM'),
pets('FRE-HUB-PETS'),
orders('FRE-HUB-ORDERS'),
completeSchedule('FRE-HUB-COMPLETE-SCHEDULE'),
@ -236,6 +237,13 @@ class License {
startDate: '',
quantity: 0,
),
Module(
key: LicenseKeys.about.value,
display: ModuleStatus.active.key,
expirationDate: '',
startDate: '',
quantity: 0,
),
Module(
key: LicenseKeys.logout.value,
display: ModuleStatus.active.key,

View File

@ -965,10 +965,10 @@ packages:
dependency: transitive
description:
name: io
sha256: "2ec25704aba361659e10e3e5f5d672068d332fc8ac516421d483a11e5cbd061e"
sha256: dfd5a80599cf0165756e3181807ed3e77daf6dd4137caaad72d0b7931597650b
url: "https://pub.dev"
source: hosted
version: "1.0.4"
version: "1.0.5"
iregexp:
dependency: transitive
description:
@ -1117,10 +1117,10 @@ packages:
dependency: "direct main"
description:
name: material_symbols_icons
sha256: a783133f87c58e10b1cc19797f7c3192ff9c2bab301c4ade90312d8f2aed01b2
sha256: "64404f47f8e0a9d20478468e5decef867a688660bad7173adcd20418d7f892c9"
url: "https://pub.dev"
source: hosted
version: "4.2800.2"
version: "4.2801.0"
maybe_just_nothing:
dependency: transitive
description:
@ -1181,10 +1181,26 @@ packages:
dependency: transitive
description:
name: package_config
sha256: "1c5b77ccc91e4823a5af61ee74e6b972db1ef98c2ff5a18d3161c982a55448bd"
sha256: "92d4488434b520a62570293fbd33bb556c7d49230791c1b4bbd973baf6d2dc67"
url: "https://pub.dev"
source: hosted
version: "2.1.0"
version: "2.1.1"
package_info_plus:
dependency: "direct main"
description:
name: package_info_plus
sha256: da8d9ac8c4b1df253d1a328b7bf01ae77ef132833479ab40763334db13b91cce
url: "https://pub.dev"
source: hosted
version: "8.1.1"
package_info_plus_platform_interface:
dependency: transitive
description:
name: package_info_plus_platform_interface
sha256: ac1f4a4847f1ade8e6a87d1f39f5d7c67490738642e2542f559ec38c37489a66
url: "https://pub.dev"
source: hosted
version: "3.0.1"
page_transition:
dependency: "direct main"
description:
@ -1221,10 +1237,10 @@ packages:
dependency: "direct main"
description:
name: path_provider_android
sha256: "8c4967f8b7cb46dc914e178daa29813d83ae502e0529d7b0478330616a691ef7"
sha256: "4adf4fd5423ec60a29506c76581bc05854c55e3a0b72d35bb28d661c9686edf2"
url: "https://pub.dev"
source: hosted
version: "2.2.14"
version: "2.2.15"
path_provider_foundation:
dependency: "direct main"
description:
@ -1373,10 +1389,10 @@ packages:
dependency: transitive
description:
name: pub_semver
sha256: "40d3ab1bbd474c4c2328c91e3a7df8c6dd629b79ece4c4bd04bee496a224fb0c"
sha256: "7b3cfbf654f3edd0c6298ecd5be782ce997ddf0e00531b9464b55245185bbbbd"
url: "https://pub.dev"
source: hosted
version: "2.1.4"
version: "2.1.5"
pubspec_parse:
dependency: transitive
description:

View File

@ -102,6 +102,7 @@ dependencies:
# dio: ^5.7.0
# crypto: ^3.0.5
freezed_annotation: ^2.4.4
package_info_plus: ^8.1.1
# json_annotation: ^4.9.0
dependency_overrides: