Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI code refactor #22

Open
wants to merge 17 commits into
base: dev
Choose a base branch
from
44 changes: 13 additions & 31 deletions lib/app/presentation/create-form/pages/create_form_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class _CreateFormPageState extends State<CreateFormPage> {
children: [
Center(
child: Text(
'Crie um formulário',
S.current.createForm,
style: Theme.of(context).textTheme.displayLarge,
textAlign: TextAlign.center,
),
Expand All @@ -118,7 +118,7 @@ class _CreateFormPageState extends State<CreateFormPage> {
mainAxisSize: MainAxisSize.max,
children: [
Text(
'Selecionar valor',
S.current.createForm,
style: TextStyle(
color: AppColors.primaryBlue,
fontWeight: FontWeight.bold,
Expand All @@ -143,23 +143,13 @@ class _CreateFormPageState extends State<CreateFormPage> {
}
return null;
},
hint: const Text(
'Selecionar valor',
hint: Text(
S.current.selectValue,
textAlign: TextAlign.center,
),
decoration: InputDecoration(
contentPadding: const EdgeInsets.only(bottom: 8),
hintText: 'Selecionar valor',
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(
color:
Theme.of(context).colorScheme.primary,
width: 1)),
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(
color:
Theme.of(context).colorScheme.primary,
width: 1)),
hintText: S.current.selectValue,
),
items: templates.map(
(template) {
Expand All @@ -186,7 +176,6 @@ class _CreateFormPageState extends State<CreateFormPage> {
Padding(
padding: const EdgeInsets.only(bottom: 8),
child: Card(

child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: AppDimensions.paddingMedium,
Expand All @@ -198,7 +187,7 @@ class _CreateFormPageState extends State<CreateFormPage> {
mainAxisSize: MainAxisSize.max,
children: [
Text(
'Selecionar valor',
S.current.selectValue,
style: TextStyle(
color: AppColors.primaryBlue,
fontWeight: FontWeight.bold,
Expand All @@ -223,23 +212,13 @@ class _CreateFormPageState extends State<CreateFormPage> {
}
return null;
},
hint: const Text(
'Selecionar valor',
hint: Text(
S.current.selectValue,
textAlign: TextAlign.center,
),
decoration: InputDecoration(
contentPadding: const EdgeInsets.only(bottom: 8),
hintText: 'Selecionar valor',
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(
color:
Theme.of(context).colorScheme.primary,
width: 1)),
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(
color:
Theme.of(context).colorScheme.primary,
width: 1)),
hintText: S.current.selectValue,
),
items: PriorityEnum.values.map(
(priority) {
Expand Down Expand Up @@ -272,7 +251,7 @@ class _CreateFormPageState extends State<CreateFormPage> {
),
),
const SizedBox(
width: 8,
width: 5,
),
Expanded(
child: TextFieldWidget(
Expand Down Expand Up @@ -362,6 +341,9 @@ class _CreateFormPageState extends State<CreateFormPage> {
isEnabled: false,
),
),
const SizedBox(
width: 5,
),
Expanded(
child: TextFieldWidget(
label: 'Longitude',
Expand Down
12 changes: 2 additions & 10 deletions lib/app/presentation/create-form/widgets/text_field_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -64,19 +64,11 @@ class TextFieldWidget extends StatelessWidget {
}
return null;
},
decoration: InputDecoration(
decoration: const InputDecoration(
isDense: true,
isCollapsed: true,
contentPadding: const EdgeInsets.only(bottom: 8),
contentPadding: EdgeInsets.only(bottom: 8),
hintText: 'Insira o texto',
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: Theme.of(context).colorScheme.primary,
width: 1)),
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: Theme.of(context).colorScheme.primary,
width: 1)),
),
),
),
Expand Down
50 changes: 23 additions & 27 deletions lib/app/presentation/form/pages/form_details_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,19 @@ class FormDetailsPage extends StatelessWidget {
child: SafeArea(
child: Scaffold(
appBar: AppBar(
centerTitle: true,
title: Text(
S.current.details,
style: Theme.of(context).textTheme.displayLarge,
),
),
centerTitle: true,
title: Text(
S.current.details,
style: Theme.of(context).textTheme.displayLarge,
),
leading: IconButton(
icon: Icon(
Icons.arrow_back,
color: AppColors.primaryBlue,
size: AppDimensions.iconLarge,
),
onPressed: () => Navigator.pop(context),
)),
body: ListView(
padding: const EdgeInsets.all(AppDimensions.paddingMedium),
children: [
Expand Down Expand Up @@ -210,7 +217,7 @@ class FormDetails extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
'Informações adicionais:',
S.current.additionalInformation,
style: Theme.of(context).textTheme.displayLarge!.copyWith(
color: AppColors.white,
),
Expand All @@ -230,7 +237,7 @@ class FormDetails extends StatelessWidget {
Padding(
padding: const EdgeInsets.only(bottom: AppDimensions.paddingSmall),
child: Text(
'Imagem Auxiliar:',
S.current.helpImage,
style: Theme.of(context).textTheme.bodyLarge!.copyWith(
color: AppColors.white,
fontWeight: FontWeight.bold,
Expand Down Expand Up @@ -267,7 +274,7 @@ class FormDetails extends StatelessWidget {
Padding(
padding: const EdgeInsets.only(bottom: AppDimensions.paddingSmall),
child: Text(
'Localização:',
S.current.location,
style: Theme.of(context).textTheme.bodyLarge!.copyWith(
color: AppColors.white,
fontWeight: FontWeight.bold,
Expand All @@ -277,6 +284,7 @@ class FormDetails extends StatelessWidget {
SizedBox(
height: 200,
child: GoogleMap(

mapType: MapType.normal,
markers: {
Marker(
Expand All @@ -302,7 +310,7 @@ class FormDetails extends StatelessWidget {
Padding(
padding: const EdgeInsets.only(bottom: AppDimensions.paddingSmall),
child: Text(
'Texto Auxiliar:',
S.current.helpText,
style: Theme.of(context).textTheme.bodyLarge!.copyWith(
color: AppColors.white,
fontWeight: FontWeight.bold,
Expand Down Expand Up @@ -345,7 +353,7 @@ class JustificationView extends StatelessWidget {
child: Column(
children: [
Text(
'Justificativa Apresentada:',
S.current.giveJustification,
style: Theme.of(context).textTheme.displayLarge!.copyWith(
color: AppColors.white,
),
Expand All @@ -358,7 +366,7 @@ class JustificationView extends StatelessWidget {
child: Column(
children: [
Text(
'Texto Justificado:',
S.current.justificationText,
textAlign: TextAlign.justify,
style:
Theme.of(context).textTheme.bodyLarge!.copyWith(
Expand Down Expand Up @@ -391,7 +399,7 @@ class JustificationView extends StatelessWidget {
child: Column(
children: [
Text(
'Imagem Justificada:',
S.current.justificationImage,
textAlign: TextAlign.justify,
style:
Theme.of(context).textTheme.bodyLarge!.copyWith(
Expand Down Expand Up @@ -564,26 +572,14 @@ class FormDetailsActions extends StatelessWidget {
return ElevatedButton(
onPressed: onPressed,
style: ElevatedButton.styleFrom(
padding: const EdgeInsets.symmetric(
vertical: AppDimensions.paddingMedium * 1.2,
),
shape: StadiumBorder(
side: hasBorder
? BorderSide(
color: Theme.of(context).colorScheme.primary,
width: 1.5,
)
: BorderSide.none,
),
backgroundColor:
backgroundColor ?? Theme.of(context).colorScheme.primary,
),
child: Text(
text,
textAlign: TextAlign.center,
style: Theme.of(context).textTheme.bodyLarge!.copyWith(
color: textColor ?? AppColors.white,
),
style: Theme.of(context).textTheme.titleMedium!.copyWith(
color: textColor ?? AppColors.white, fontWeight: FontWeight.bold),
),
);
}
Expand Down
6 changes: 2 additions & 4 deletions lib/app/presentation/form/pages/form_sections_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,9 @@ class FormSectionsPageState extends State<FormSectionsPage> {
child: Scaffold(
appBar: AppBar(
centerTitle: true,
backgroundColor: AppColors.primaryBlue,
leading: IconButton(
icon: Icon(
icon: const Icon(
Icons.arrow_back,
color: AppColors.white,
size: AppDimensions.iconLarge,
),
onPressed: () => Navigator.pop(context),
Expand All @@ -48,7 +46,7 @@ class FormSectionsPageState extends State<FormSectionsPage> {
style: Theme.of(context)
.textTheme
.displayLarge!
.copyWith(color: AppColors.white),
.copyWith(color: AppColors.primaryBlue),
),
],
),
Expand Down
9 changes: 2 additions & 7 deletions lib/app/presentation/form/stores/single_form_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ class SingleFormProvider extends ChangeNotifier {
await _formsProvider.saveForm(
form: form,
);
await Future.delayed(const Duration(milliseconds: 300));

setIsFormStateLoading(false);
}

Expand All @@ -69,13 +71,6 @@ class SingleFormProvider extends ChangeNotifier {
setIsFormStateLoading(false);
}

bool isSendingForm = false;

void setIsSendingForm(bool value) {
isSendingForm = value;
notifyListeners();
}

void setFieldValue(String sectionId, String key, dynamic value) {
var field = form.sections
.firstWhere((section) => section.sectionId == sectionId)
Expand Down
Loading
Loading