Changes to be committed:
new file: lib/assets/images/algodao.png new file: lib/assets/images/cafe.png new file: lib/assets/images/cana.png new file: lib/assets/images/milho.png new file: lib/assets/images/soja.png new file: lib/assets/images/trigo.png deleted: lib/assets/logos/old/logo_branca.png deleted: lib/assets/logos/old/logo_primary.png modified: lib/src/app/auth/screens/cadastro.dart modified: lib/src/app/auth/screens/codigoverifica.dart modified: lib/src/app/auth/screens/login.dart new file: lib/src/app/base/screens/navigator.dart new file: lib/src/app/home/screens/home_screen.dart new file: lib/src/app/home/widgets/card_info_card.dart modified: lib/src/router.dart new file: lib/src/shared/widgets/back_button.dart modified: lib/src/shared/widgets/buttons/simple_button.dart modified: lib/src/shared/widgets/inputs/code_input.dart modified: lib/src/shared/widgets/inputs/password_input.dart new file: lib/src/shared/widgets/inputs/search_controller.dart modified: lib/src/shared/widgets/inputs/simple_input.dart modified: pubspec.lock modified: pubspec.yaml
BIN
lib/assets/images/algodao.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
lib/assets/images/cafe.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
lib/assets/images/cana.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
lib/assets/images/milho.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
lib/assets/images/soja.png
Normal file
After Width: | Height: | Size: 2.5 KiB |
BIN
lib/assets/images/trigo.png
Normal file
After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 64 KiB |
Before Width: | Height: | Size: 72 KiB |
@ -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<CadastroScreen> {
|
||||
TextEditingController codeController = TextEditingController();
|
||||
TextEditingController nomeCompletoController = TextEditingController();
|
||||
final GlobalKey<FormState> _formKey = GlobalKey<FormState>();
|
||||
final GlobalKey<FormState> _form2Key = GlobalKey<FormState>();
|
||||
// final GlobalKey<FormState> _form2Key = GlobalKey<FormState>();
|
||||
bool firstStep = true;
|
||||
|
||||
bool isloading = false;
|
||||
@ -92,19 +93,8 @@ class _CadastroScreenState extends ConsumerState<CadastroScreen> {
|
||||
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",
|
||||
|
@ -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<CodigoVerificacaoScree
|
||||
TextEditingController senhaController = TextEditingController();
|
||||
TextEditingController codeController = TextEditingController();
|
||||
TextEditingController nomeCompletoController = TextEditingController();
|
||||
final GlobalKey<FormState> _formKey = GlobalKey<FormState>();
|
||||
// final GlobalKey<FormState> _formKey = GlobalKey<FormState>();
|
||||
final GlobalKey<FormState> _form2Key = GlobalKey<FormState>();
|
||||
bool firstStep = true;
|
||||
|
||||
@ -89,18 +89,7 @@ class _CodigoVerificacaoScreenState extends ConsumerState<CodigoVerificacaoScree
|
||||
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)
|
||||
),
|
||||
),
|
||||
const BackButtonWidget(),
|
||||
const SizedBox(width: 10),
|
||||
SizedBox(
|
||||
child: Text(
|
||||
|
@ -3,6 +3,7 @@ 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/app/auth/screens/cadastro.dart';
|
||||
import 'package:recomendagro/src/app/home/screens/home_screen.dart';
|
||||
import 'package:recomendagro/src/shared/utils/enums.dart';
|
||||
import 'package:recomendagro/src/shared/utils/responsive/responsive_metrics.dart';
|
||||
import 'package:recomendagro/src/shared/widgets/buttons/simple_button.dart';
|
||||
@ -141,7 +142,7 @@ class _LoginScreenState extends ConsumerState<LoginScreen> {
|
||||
label: 'Fazer login',
|
||||
isloading: isloading,
|
||||
onTap: (){
|
||||
|
||||
context.push(HomeScreen.path);
|
||||
}
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
|
38
lib/src/app/base/screens/navigator.dart
Normal file
@ -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<NavigatorScreen> with WidgetsBindingObserver{
|
||||
final GlobalKey<ScaffoldState> scaffoldKey = GlobalKey<ScaffoldState>();
|
||||
|
||||
|
||||
@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,
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
205
lib/src/app/home/screens/home_screen.dart
Normal file
@ -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<HomeScreen> createState() => _HomeScreenState();
|
||||
}
|
||||
|
||||
class _HomeScreenState extends State<HomeScreen> {
|
||||
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
|
||||
final GlobalKey<FormState> _formKey = GlobalKey<FormState>();
|
||||
|
||||
@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),
|
||||
]
|
||||
),
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
48
lib/src/app/home/widgets/card_info_card.dart
Normal file
@ -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
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
@ -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<NavigatorState> _rootNavigatorKey = GlobalKey<NavigatorState>(debugLabel: 'root');
|
||||
final GlobalKey<NavigatorState> _shellNavigatorKey = GlobalKey<NavigatorState>(debugLabel: 'shell');
|
||||
@ -35,6 +37,20 @@ final routerProvider = Provider<GoRouter>((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,
|
||||
|
24
lib/src/shared/widgets/back_button.dart
Normal file
@ -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)
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -99,7 +99,7 @@ class _ButtonWidgetState extends State<ButtonWidget> {
|
||||
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<ButtonWidget> {
|
||||
|
||||
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)
|
||||
);
|
||||
|
@ -17,15 +17,15 @@ class _CodeInputControllerState extends State<CodeInputController> {
|
||||
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),
|
||||
),
|
||||
);
|
||||
|
||||
|
@ -40,7 +40,7 @@ class _PasswordInputState extends State<PasswordInput> {
|
||||
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)
|
||||
|
145
lib/src/shared/widgets/inputs/search_controller.dart
Normal file
@ -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<TextInputFormatter>? 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<SearchInput> {
|
||||
@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
|
||||
),
|
||||
),
|
||||
)
|
||||
)
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -60,7 +60,7 @@ class _SimpleInputState extends State<SimpleInput> {
|
||||
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
|
||||
),
|
||||
|
@ -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:
|
||||
|
@ -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:
|
||||
|