diff --git a/lib/assets/images/algodao.png b/lib/assets/images/algodao.png new file mode 100644 index 0000000..d76b549 Binary files /dev/null and b/lib/assets/images/algodao.png differ diff --git a/lib/assets/images/cafe.png b/lib/assets/images/cafe.png new file mode 100644 index 0000000..bdb583f Binary files /dev/null and b/lib/assets/images/cafe.png differ diff --git a/lib/assets/images/cana.png b/lib/assets/images/cana.png new file mode 100644 index 0000000..2e9011a Binary files /dev/null and b/lib/assets/images/cana.png differ diff --git a/lib/assets/images/milho.png b/lib/assets/images/milho.png new file mode 100644 index 0000000..beec33a Binary files /dev/null and b/lib/assets/images/milho.png differ diff --git a/lib/assets/images/soja.png b/lib/assets/images/soja.png new file mode 100644 index 0000000..4b29524 Binary files /dev/null and b/lib/assets/images/soja.png differ diff --git a/lib/assets/images/trigo.png b/lib/assets/images/trigo.png new file mode 100644 index 0000000..1d96075 Binary files /dev/null and b/lib/assets/images/trigo.png differ diff --git a/lib/assets/logos/old/logo_branca.png b/lib/assets/logos/old/logo_branca.png deleted file mode 100644 index 341f41a..0000000 Binary files a/lib/assets/logos/old/logo_branca.png and /dev/null differ diff --git a/lib/assets/logos/old/logo_primary.png b/lib/assets/logos/old/logo_primary.png deleted file mode 100644 index 5255d6c..0000000 Binary files a/lib/assets/logos/old/logo_primary.png and /dev/null differ diff --git a/lib/src/app/auth/screens/cadastro.dart b/lib/src/app/auth/screens/cadastro.dart index 39b0ecb..eea3d5e 100644 --- a/lib/src/app/auth/screens/cadastro.dart +++ b/lib/src/app/auth/screens/cadastro.dart @@ -4,6 +4,7 @@ import 'package:go_router/go_router.dart'; import 'package:recomendagro/assets/theme/colors.dart'; import 'package:recomendagro/src/app/auth/screens/codigoverifica.dart'; import 'package:recomendagro/src/shared/utils/responsive/responsive_metrics.dart'; +import 'package:recomendagro/src/shared/widgets/back_button.dart'; import 'package:recomendagro/src/shared/widgets/buttons/simple_button.dart'; import 'package:recomendagro/src/shared/widgets/inputs/password_input.dart'; import '../../../shared/widgets/inputs/simple_input.dart'; @@ -26,7 +27,7 @@ class _CadastroScreenState extends ConsumerState { TextEditingController codeController = TextEditingController(); TextEditingController nomeCompletoController = TextEditingController(); final GlobalKey _formKey = GlobalKey(); - final GlobalKey _form2Key = GlobalKey(); + // final GlobalKey _form2Key = GlobalKey(); bool firstStep = true; bool isloading = false; @@ -92,19 +93,8 @@ class _CadastroScreenState extends ConsumerState { const SizedBox(height: 30), Row( children: [ - GestureDetector( - onTap: (){ - context.pop(); - }, - child: Container( - decoration: BoxDecoration( - border: Border.all(width: 1, color: AppColorLight.text04Color), - borderRadius: BorderRadius.circular(10) - ), - child: Icon(Icons.chevron_left) - ), - ), - SizedBox(width: 10), + const BackButtonWidget(), + const SizedBox(width: 10), SizedBox( child: Text( "Cadastro", diff --git a/lib/src/app/auth/screens/codigoverifica.dart b/lib/src/app/auth/screens/codigoverifica.dart index e39e174..c95933b 100644 --- a/lib/src/app/auth/screens/codigoverifica.dart +++ b/lib/src/app/auth/screens/codigoverifica.dart @@ -3,9 +3,9 @@ import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:go_router/go_router.dart'; import 'package:recomendagro/assets/theme/colors.dart'; import 'package:recomendagro/src/shared/utils/responsive/responsive_metrics.dart'; +import 'package:recomendagro/src/shared/widgets/back_button.dart'; import 'package:recomendagro/src/shared/widgets/buttons/simple_button.dart'; import 'package:recomendagro/src/shared/widgets/inputs/code_input.dart'; -import '../../../shared/widgets/inputs/simple_input.dart'; class CodigoVerificacaoScreen extends ConsumerStatefulWidget { static String path = '/verificacodigo'; @@ -24,7 +24,7 @@ class _CodigoVerificacaoScreenState extends ConsumerState _formKey = GlobalKey(); + // final GlobalKey _formKey = GlobalKey(); final GlobalKey _form2Key = GlobalKey(); bool firstStep = true; @@ -89,18 +89,7 @@ class _CodigoVerificacaoScreenState extends ConsumerState { label: 'Fazer login', isloading: isloading, onTap: (){ - + context.push(HomeScreen.path); } ), const SizedBox(height: 20), diff --git a/lib/src/app/base/screens/navigator.dart b/lib/src/app/base/screens/navigator.dart new file mode 100644 index 0000000..edf3904 --- /dev/null +++ b/lib/src/app/base/screens/navigator.dart @@ -0,0 +1,38 @@ +import 'dart:async'; +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:go_router/go_router.dart'; + +class NavigatorScreen extends ConsumerStatefulWidget { + final Widget? child; + const NavigatorScreen({Key? key, this.child}) : super(key: key); + + @override + _NavigatorScreenState createState() => _NavigatorScreenState(); +} + +class _NavigatorScreenState extends ConsumerState with WidgetsBindingObserver{ + final GlobalKey scaffoldKey = GlobalKey(); + + + @override + void dispose() { + super.dispose(); + WidgetsBinding.instance.removeObserver(this); + } + + @override + Widget build(BuildContext context) { + return WillPopScope( + onWillPop: () async { + return Future.value(false); + }, + child: ProviderScope( + child: Scaffold( + key: scaffoldKey, + body: widget.child, + ), + ) + ); + } +} \ No newline at end of file diff --git a/lib/src/app/home/screens/home_screen.dart b/lib/src/app/home/screens/home_screen.dart new file mode 100644 index 0000000..161826e --- /dev/null +++ b/lib/src/app/home/screens/home_screen.dart @@ -0,0 +1,205 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_font_icons/flutter_font_icons.dart'; +import 'package:recomendagro/assets/theme/colors.dart'; +import 'package:recomendagro/src/app/home/widgets/card_info_card.dart'; +import 'package:recomendagro/src/shared/utils/responsive/responsive_metrics.dart'; +import 'package:recomendagro/src/shared/widgets/inputs/search_controller.dart'; + +class HomeScreen extends StatefulWidget { + static String path = '/homescreen'; + const HomeScreen({super.key}); + + @override + State createState() => _HomeScreenState(); +} + +class _HomeScreenState extends State { + final GlobalKey _scaffoldKey = GlobalKey(); + final GlobalKey _formKey = GlobalKey(); + + @override + Widget build(BuildContext context) { + Radius radius = const Radius.circular(30); + return Scaffold( + key: _scaffoldKey, + extendBodyBehindAppBar: true, + appBar: const PreferredSize( + preferredSize: Size.fromHeight(0), + child: SizedBox(), + ), + body: SingleChildScrollView( + child: Container( + decoration: BoxDecoration( + color: Theme.of(context).primaryColor, + image: const DecorationImage( + image: AssetImage('lib/assets/images/bg_header.png'), + fit: BoxFit.cover, + ) + ), + child: Column( + children: [ + const SizedBox(height: 40), + SafeArea( + bottom: false, + child: SizedBox( + child: Padding( + padding: const EdgeInsets.only(left: 20, right: 20, top: 20, bottom: 20), + child: Row( + children: [ + Expanded( + child: Column( + children: [ + SizedBox( + width: double.infinity, + child: Text( + "Ola!", + textAlign: TextAlign.start, + style: Theme.of(context).textTheme.bodySmall?.copyWith( + fontWeight: FontWeight.w100, + color: AppColorLight.text04Color, + fontSize: 18 + ) + ) + ), + SizedBox( + width: double.infinity, + child: Text( + "Steeve bernard", + textAlign: TextAlign.start, + style: Theme.of(context).textTheme.bodySmall?.copyWith( + fontWeight: FontWeight.bold, + color: AppColorLight.text06Color, + fontSize: 24 + ) + ) + ), + + ] + ) + ), + CircleAvatar( + backgroundColor: AppColorLight.secondaryColor, + radius: 30, + child: Text( + "S", + textAlign: TextAlign.start, + style: Theme.of(context).textTheme.bodyMedium?.copyWith( + fontWeight: FontWeight.bold, + color: AppColorLight.text06Color, + fontSize: 27 + ) + ), + ) + ], + ), + ) + ), + ), + ClipRRect( + borderRadius: BorderRadius.only( + topLeft: radius, + topRight: radius + ), + child: Container( + padding: const EdgeInsets.symmetric(horizontal: 20), + decoration: BoxDecoration( + color: Theme.of(context).scaffoldBackgroundColor + ), + child: Form( + key: _formKey, + child: Center( + child: SingleChildScrollView( + child: Column( + children: [ + // const SizedBox(height: 15), + // SizedBox( + // width: double.infinity, + // child: Text( + // "Selecione as informacoes", + // textAlign: TextAlign.start, + // style: Theme.of(context).textTheme.bodyMedium?.copyWith( + // fontWeight: FontWeight.w600, + // color: AppColorLight.text01Color, + // fontSize: 20 + // ) + // ) + // ), + // SizedBox( + // width: double.infinity, + // child: Text( + // "Novo registro de dados", + // textAlign: TextAlign.start, + // style: Theme.of(context).textTheme.bodySmall?.copyWith( + // fontWeight: FontWeight.w100, + // color: AppColorLight.text03Color, + // fontSize: 15 + // ) + // ) + // ), + const SizedBox(height: 20), + SearchInput( + hintText: 'Pesquisar', + showIcon: true, + prefixIcon: Feather.search, + textInputType: TextInputType.text, + textInputAction: TextInputAction.search, + onFieldSubmitted: (value) async { + } + ), + const SizedBox(height: 20), + Row( + children: [ + CardInfoCardWidget( + svg: 'lib/assets/images/algodao.png', + title: 'Algodão', + ), + SizedBox(width: 20), + CardInfoCardWidget( + svg: 'lib/assets/images/cafe.png', + title: 'Café', + ), + ], + ), + const SizedBox(height: 20), + Row( + children: [ + CardInfoCardWidget( + svg: 'lib/assets/images/cana.png', + title: 'Cana', + ), + SizedBox(width: 20), + CardInfoCardWidget( + svg: 'lib/assets/images/milho.png', + title: 'Milho', + ) + ], + ), + const SizedBox(height: 20), + Row( + children: [ + CardInfoCardWidget( + svg: 'lib/assets/images/soja.png', + title: 'Soja', + ), + SizedBox(width: 20), + CardInfoCardWidget( + svg: 'lib/assets/images/trigo.png', + title: 'Trigo', + ), + ], + ), + const SizedBox(height: 20), + ] + ), + ) + ) + ) + ) + ) + ], + ), + ), + ) + ); + } +} \ No newline at end of file diff --git a/lib/src/app/home/widgets/card_info_card.dart b/lib/src/app/home/widgets/card_info_card.dart new file mode 100644 index 0000000..d6a7af8 --- /dev/null +++ b/lib/src/app/home/widgets/card_info_card.dart @@ -0,0 +1,48 @@ +import 'package:flutter/material.dart'; +import 'package:recomendagro/assets/theme/colors.dart'; + +class CardInfoCardWidget extends StatelessWidget { + final String svg; + final String title; + const CardInfoCardWidget({super.key, required this.svg, required this.title}); + + @override + Widget build(BuildContext context) { + return Expanded( + child: Container( + height: 200, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(18), + boxShadow: [ + BoxShadow( + color: AppColorLight.primaryColor, + spreadRadius: 0, + blurRadius: 1, + blurStyle: BlurStyle.outer + ) + ] + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + SizedBox( + child: Image.asset( + svg, + fit: BoxFit.fill + ) + ), + const SizedBox(height: 10), + Text(title, + style: Theme.of(context).textTheme.bodySmall?.copyWith( + fontWeight: FontWeight.bold, + color: AppColorLight.primaryColor, + fontSize: 15 + ), + ) + ], + ), + ) + ); + } +} \ No newline at end of file diff --git a/lib/src/router.dart b/lib/src/router.dart index 8df6e5e..1c31926 100644 --- a/lib/src/router.dart +++ b/lib/src/router.dart @@ -1,10 +1,12 @@ import 'package:recomendagro/src/app/auth/screens/cadastro.dart'; import 'package:recomendagro/src/app/auth/screens/codigoverifica.dart'; import 'package:recomendagro/src/app/auth/screens/login.dart'; +import 'package:recomendagro/src/app/base/screens/navigator.dart'; import 'package:recomendagro/src/app/base/screens/splash.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:go_router/go_router.dart'; +import 'package:recomendagro/src/app/home/screens/home_screen.dart'; final GlobalKey _rootNavigatorKey = GlobalKey(debugLabel: 'root'); final GlobalKey _shellNavigatorKey = GlobalKey(debugLabel: 'shell'); @@ -35,6 +37,20 @@ final routerProvider = Provider((ref) { parentNavigatorKey: _rootNavigatorKey, builder: (_, state) => const CodigoVerificacaoScreen() ), + ShellRoute( + navigatorKey: _shellNavigatorKey, + builder: (context, state, child) => NavigatorScreen(child: child), + routes: [ + GoRoute( + path: HomeScreen.path, + name: 'inicio_vistoria', + pageBuilder: (_, state) => transitionScreen( + state.pageKey, + child: const HomeScreen(), + ) + ) + ] + ), // GoRoute( // path: RecuperarContaScreen.path, // parentNavigatorKey: _rootNavigatorKey, diff --git a/lib/src/shared/widgets/back_button.dart b/lib/src/shared/widgets/back_button.dart new file mode 100644 index 0000000..2d2291c --- /dev/null +++ b/lib/src/shared/widgets/back_button.dart @@ -0,0 +1,24 @@ +import 'package:flutter/material.dart'; +import 'package:go_router/go_router.dart'; +import 'package:recomendagro/assets/theme/colors.dart'; + +class BackButtonWidget extends StatelessWidget { + const BackButtonWidget({super.key}); + + @override + Widget build(BuildContext context) { + return GestureDetector( + onTap: (){ + context.pop(); + }, + child: Container( + padding: const EdgeInsets.all(5), + decoration: BoxDecoration( + border: Border.all(width: 1, color: AppColorLight.text04Color), + borderRadius: BorderRadius.circular(10) + ), + child: const Icon(Icons.chevron_left) + ), + ); + } +} \ No newline at end of file diff --git a/lib/src/shared/widgets/buttons/simple_button.dart b/lib/src/shared/widgets/buttons/simple_button.dart index f0aaa60..7e8bbe3 100644 --- a/lib/src/shared/widgets/buttons/simple_button.dart +++ b/lib/src/shared/widgets/buttons/simple_button.dart @@ -99,7 +99,7 @@ class _ButtonWidgetState extends State { BoxDecoration defineDecoration(BuildContext context, {required TypeButton? type, required bool disabled}){ if((type == TypeButton.cancel)||(type == TypeButton.secondary) && disabled){ return BoxDecoration( - border: Border.all(width: 2, color: AppColorLight.text04Color), + border: Border.all(width: 1, color: AppColorLight.text04Color), borderRadius: BorderRadius.circular(10) ); } @@ -113,13 +113,13 @@ class _ButtonWidgetState extends State { if(type == TypeButton.cancel){ return BoxDecoration( - border: Border.all(width: 2, color: AppColorLight.text04Color), + border: Border.all(width: 1, color: AppColorLight.text04Color), borderRadius: BorderRadius.circular(10) ); } if(type == TypeButton.secondary){ return BoxDecoration( - border: Border.all(width: 2, color: widget.color ?? Theme.of(context).primaryColor), + border: Border.all(width: 1, color: widget.color ?? Theme.of(context).primaryColor), color: isHover ? widget.color ?? Theme.of(context).primaryColor : null, borderRadius: BorderRadius.circular(10) ); diff --git a/lib/src/shared/widgets/inputs/code_input.dart b/lib/src/shared/widgets/inputs/code_input.dart index 7921558..9f058db 100644 --- a/lib/src/shared/widgets/inputs/code_input.dart +++ b/lib/src/shared/widgets/inputs/code_input.dart @@ -17,15 +17,15 @@ class _CodeInputControllerState extends State { Widget build(BuildContext context) { final focusedBorderColor = Theme.of(context).primaryColor; final defaultPinTheme = PinTheme( - width: 56, - height: 56, + width: 60, + height: 60, textStyle: TextStyle( fontSize: 22, color: AppColorLight.text01Color, ), decoration: BoxDecoration( borderRadius: BorderRadius.circular(50), - border: Border.all(width: 2, color: AppColorLight.text04Color), + border: Border.all(width: 1, color: AppColorLight.text04Color), ), ); diff --git a/lib/src/shared/widgets/inputs/password_input.dart b/lib/src/shared/widgets/inputs/password_input.dart index a736460..0103fe9 100644 --- a/lib/src/shared/widgets/inputs/password_input.dart +++ b/lib/src/shared/widgets/inputs/password_input.dart @@ -40,7 +40,7 @@ class _PasswordInputState extends State { padding: const EdgeInsets.symmetric(horizontal: 15), decoration: BoxDecoration( border: Border.all( - width: 2, + width: 1, color: InputUtils.getColorBorder(statusValided: statusValided, enabled: true) ), borderRadius: BorderRadius.circular(10) diff --git a/lib/src/shared/widgets/inputs/search_controller.dart b/lib/src/shared/widgets/inputs/search_controller.dart new file mode 100644 index 0000000..7b8a775 --- /dev/null +++ b/lib/src/shared/widgets/inputs/search_controller.dart @@ -0,0 +1,145 @@ +// ignore_for_file: public_member_api_docs, sort_constructors_first +import 'package:bestapp_package/bestapp_package.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:recomendagro/assets/theme/colors.dart'; + +class SearchInput extends StatefulWidget { + final TextEditingController? textController; + final bool? showIcon; + final IconData? prefixIcon; + final String? hintText; + final bool enable; + final IconData? sufixIcon; + final TextInputType? textInputType; + final List? inputFormatters; + final Function? onSufixtap; + final int? maxLines; + final Function? onChanged; + final Function(String)? onFieldSubmitted; + final bool validator; + final bool validatorEmail; + final bool validatorPhone; + final String? labelText; + final TextInputAction textInputAction; + const SearchInput({ + Key? key, + this.textController, + this.showIcon, + this.prefixIcon, + this.hintText, + this.enable=true, + this.sufixIcon, + this.textInputType, + this.inputFormatters, + this.onSufixtap, + this.maxLines, + this.onChanged, + this.onFieldSubmitted, + this.validator=true, + this.validatorEmail=false, + this.validatorPhone=false, + this.textInputAction = TextInputAction.done, + this.labelText, + }) : super(key: key); + + @override + _SearchInput createState() => _SearchInput(); +} + +class _SearchInput extends State { + @override + void initState() { + super.initState(); + } + @override + Widget build(BuildContext context) { + return MediaQuery( + data: MediaQuery.of(context).copyWith( + textScaleFactor: 1.0, + ), + child: Container( + padding: const EdgeInsets.all(0), + width: MediaQuery.of(context).size.width, + child: TextFormField( + validator: (value) { + if (value!.isEmpty && widget.validator) { + return 'Campo não pode estar vazio!'; + } + if(!EmailValidator.validate(value) && widget.validatorEmail == true && value.isNotEmpty){ + return 'E-mail inválido!'; + } + if(value.isNotEmpty && BestappUtils.removeCaracteres(value).length < 10 && widget.validatorPhone){ + return 'Telefone inválido!'; + } + return null; + }, + controller: widget.textController, + textInputAction: widget.textInputAction, + // textCapitalization: widget.textInputType == TextInputType.emailAddress ? TextCapitalization.none : TextCapitalization.words, + enabled: widget.enable, + keyboardType: widget.textInputType, + onChanged: widget.onChanged as void Function(String)?, + onFieldSubmitted: widget.onFieldSubmitted, + inputFormatters: widget.inputFormatters, + decoration: InputDecoration( + labelText: widget.labelText, + fillColor: Theme.of(context).colorScheme.background, + filled: true, + floatingLabelBehavior: FloatingLabelBehavior.always, + contentPadding: const EdgeInsets.fromLTRB(10.0, 9.0, 10.0, 9.0), + prefixIcon: widget.prefixIcon != null ? Icon( + widget.prefixIcon, + color: AppColorLight.secondaryColor, + ) : null, + hintText: widget.hintText, + suffixIcon: widget.sufixIcon != null ? InkWell( + onTap: widget.onSufixtap as void Function()?, + child: Icon( + widget.sufixIcon, + ), + ) : null, + hintStyle: Theme.of(context).textTheme.bodyMedium!.copyWith( + fontWeight: FontWeight.normal + ), + focusedBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(10), + borderSide: BorderSide( + color: Theme.of(context).primaryColor, + width: 1.0 + ), + ), + enabledBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(10), + borderSide: BorderSide( + color: Theme.of(context).primaryColor, + width: 1.0 + ), + ), + disabledBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(10), + borderSide: BorderSide( + color: Theme.of(context).primaryColor, + width: 1.0 + ), + ), + errorBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(10), + borderSide: BorderSide( + color: Theme.of(context).colorScheme.error, + width: 1.0 + ), + ), + focusedErrorBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(10), + borderSide: BorderSide( + color: Theme.of(context).colorScheme.error, + width: 1.0 + ), + ), + ) + ) + ), + ); + } +} \ No newline at end of file diff --git a/lib/src/shared/widgets/inputs/simple_input.dart b/lib/src/shared/widgets/inputs/simple_input.dart index 7c53aaa..397038c 100644 --- a/lib/src/shared/widgets/inputs/simple_input.dart +++ b/lib/src/shared/widgets/inputs/simple_input.dart @@ -60,7 +60,7 @@ class _SimpleInputState extends State { padding: const EdgeInsets.symmetric(horizontal: 15), decoration: BoxDecoration( border: Border.all( - width: 2, + width: 1, color: InputUtils.getColorBorder(typInputText: widget.typeInput, statusValided: statusValided, enabled: widget.enabled!) // color: widget.enabled == false ? AppColorLight.text05Color : isvalidate ? AppColorLight.text04Color : AppColorLight.erroColor ), diff --git a/pubspec.lock b/pubspec.lock index 2384753..401b869 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -248,6 +248,14 @@ packages: url: "https://pub.dev" source: hosted version: "5.1.0" + flutter_font_icons: + dependency: "direct main" + description: + name: flutter_font_icons + sha256: d06eb0ab903d0e90a9a758de30892ea0d43221f03dad059970384e62479c787e + url: "https://pub.dev" + source: hosted + version: "2.2.7" flutter_image_compress: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 73508e4..2e8fa03 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -23,6 +23,7 @@ dependencies: cupertino_icons: ^1.0.2 flutter_riverpod: ^2.4.9 flutter_launcher_icons: ^0.13.1 + flutter_font_icons: ^2.2.5 pinput: ^3.0.1 bestapp_package: git: