Feat: Ajuste na tela de home, visita provisória e visita completa

This commit is contained in:
Lucas 2024-11-04 17:30:54 -03:00
parent c22e1bff5e
commit 8ce59f3f2b
8 changed files with 1510 additions and 1426 deletions

View File

@ -8,7 +8,6 @@ import 'package:hub/shared/utils/storage_util.dart';
import '../../../shared/extensions/dialog_extensions.dart'; import '../../../shared/extensions/dialog_extensions.dart';
import '../../../shared/services/localization/localization_service.dart'; import '../../../shared/services/localization/localization_service.dart';
class MenuButtonWidget extends MenuEntry { class MenuButtonWidget extends MenuEntry {
const MenuButtonWidget({ const MenuButtonWidget({
super.key, super.key,
@ -32,34 +31,41 @@ class _MenuButtonWidgetState extends State<MenuButtonWidget> {
get action => action; get action => action;
bool _isProcessing = false; bool _isProcessing = false;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final textScaler = MediaQuery.textScalerOf(context);
final double baseFontSize = 10;
final double scaledFontSize = baseFontSize * textScaler.scale(1);
final double limitedFontSize = scaledFontSize > 22 ? 10 : baseFontSize;
return InkWell( return InkWell(
splashColor: Colors.transparent, splashColor: Colors.transparent,
focusColor: Colors.transparent, focusColor: Colors.transparent,
hoverColor: Colors.transparent, hoverColor: Colors.transparent,
highlightColor: Colors.transparent, highlightColor: Colors.transparent,
onTap: _isProcessing ? null : () async { onTap: _isProcessing
setState(() { ? null
_isProcessing = true; : () async {
}); setState(() {
await LocalizationService.processLocals(context).then((value) async { _isProcessing = true;
if (value) { });
await widget.action?.call(); await LocalizationService.processLocals(context)
} else { .then((value) async {
DialogUnavailable.unavailableCredentials(context); if (value) {
} await widget.action?.call();
}); } else {
setState(() { DialogUnavailable.unavailableCredentials(context);
_isProcessing = false; }
}); });
}, setState(() {
_isProcessing = false;
});
},
child: Padding( child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 0, vertical: 0), padding: const EdgeInsets.symmetric(horizontal: 0, vertical: 0),
child: Container( child: Container(
width: 120.0, width: 300,
height: 100.0, height: 280,
decoration: BoxDecoration( decoration: BoxDecoration(
color: FlutterFlowTheme.of(context).primaryBackground, color: FlutterFlowTheme.of(context).primaryBackground,
boxShadow: [ boxShadow: [
@ -107,7 +113,7 @@ class _MenuButtonWidgetState extends State<MenuButtonWidget> {
style: FlutterFlowTheme.of(context).titleLarge.override( style: FlutterFlowTheme.of(context).titleLarge.override(
fontFamily: 'Nunito', fontFamily: 'Nunito',
color: FlutterFlowTheme.of(context).primaryText, color: FlutterFlowTheme.of(context).primaryText,
fontSize: 14.0, fontSize: limitedFontSize,
letterSpacing: 0.0, letterSpacing: 0.0,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
useGoogleFonts: useGoogleFonts:

View File

@ -36,21 +36,24 @@ class _MenuCardItemState extends State<MenuCardItem> {
focusColor: Colors.transparent, focusColor: Colors.transparent,
hoverColor: Colors.transparent, hoverColor: Colors.transparent,
highlightColor: Colors.transparent, highlightColor: Colors.transparent,
onTap: _isProcessing ? null : () async { onTap: _isProcessing
setState(() { ? null
_isProcessing = true; : () async {
}); setState(() {
await LocalizationService.processLocals(context).then((value) async { _isProcessing = true;
if (value) { });
await widget.action?.call(); await LocalizationService.processLocals(context)
} else { .then((value) async {
DialogUnavailable.unavailableCredentials(context); if (value) {
} await widget.action?.call();
}); } else {
setState(() { DialogUnavailable.unavailableCredentials(context);
_isProcessing = false; }
}); });
}, setState(() {
_isProcessing = false;
});
},
child: Card( child: Card(
elevation: 0, elevation: 0,
color: FlutterFlowTheme.of(context).primaryBackground, color: FlutterFlowTheme.of(context).primaryBackground,

View File

@ -39,8 +39,8 @@ class _LocalProfileComponentWidgetState
// //
// WidgetsBinding.instance // WidgetsBinding.instance
// .addPostFrameCallback((_) async => await LocalizationService.processLocals(context).then((value) => value == true ? onUpdate() : null)); // .addPostFrameCallback((_) async => await LocalizationService.processLocals(context).then((value) => value == true ? onUpdate() : null));
LocalizationService.processLocals(context).then((value) => value == true ? onUpdate() : null); LocalizationService.processLocals(context)
.then((value) => value == true ? onUpdate() : null);
} }
@override @override
@ -57,10 +57,13 @@ class _LocalProfileComponentWidgetState
}); });
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final textScaler = MediaQuery.textScalerOf(context);
final double baseFontSize = 14.0;
final double scaledFontSize = baseFontSize * textScaler.scale(1);
final double limitedFontSize = scaledFontSize > 14.0 ? 9 : scaledFontSize;
return Container( return Container(
decoration: const BoxDecoration(), decoration: const BoxDecoration(),
child: Align( child: Align(
@ -90,7 +93,8 @@ class _LocalProfileComponentWidgetState
hoverColor: Colors.transparent, hoverColor: Colors.transparent,
highlightColor: Colors.transparent, highlightColor: Colors.transparent,
onTap: () async { onTap: () async {
await LocalizationService.selectLocal(context).then((value) => value == true ? onUpdate() : null); await LocalizationService.selectLocal(context).then(
(value) => value == true ? onUpdate() : null);
}, },
child: ClipRRect( child: ClipRRect(
borderRadius: BorderRadius.circular(200.0), borderRadius: BorderRadius.circular(200.0),
@ -120,23 +124,36 @@ class _LocalProfileComponentWidgetState
)), )),
), ),
), ),
Text( Expanded(
valueOrDefault<String>( child: Tooltip(
functions.convertToUppercase(_model.cliName), message: valueOrDefault<String>(
FFLocalizations.of(context).getVariableText( functions.convertToUppercase(_model.cliName),
ptText: 'SEM LOCAL VINCULADO', FFLocalizations.of(context).getVariableText(
enText: 'NO LINKED LOCAL', ptText: 'SEM LOCAL VINCULADO',
enText: 'NO LINKED LOCAL',
),
),
child: Text(
valueOrDefault<String>(
functions.convertToUppercase(_model.cliName),
FFLocalizations.of(context).getVariableText(
ptText: 'SEM LOCAL VINCULADO',
enText: 'NO LINKED LOCAL',
),
),
overflow: TextOverflow.ellipsis,
maxLines: 1,
style: FlutterFlowTheme.of(context).labelMedium.override(
fontFamily: 'Nunito',
color: FlutterFlowTheme.of(context).info,
fontSize: limitedFontSize,
letterSpacing: 0.0,
fontWeight: FontWeight.w500,
useGoogleFonts:
GoogleFonts.asMap().containsKey('Nunito'),
),
), ),
), ),
style: FlutterFlowTheme.of(context).labelMedium.override(
fontFamily: 'Nunito',
color: FlutterFlowTheme.of(context).info,
fontSize: 14.0,
letterSpacing: 0.0,
fontWeight: FontWeight.w500,
useGoogleFonts:
GoogleFonts.asMap().containsKey('Nunito'),
),
), ),
] ]
.divide(const SizedBox(width: 20.0)) .divide(const SizedBox(width: 20.0))

View File

@ -52,12 +52,16 @@ class _MenuStaggeredViewComponentWidgetState
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final textScaler = MediaQuery.textScalerOf(context);
final double scaledFontSize = 14 * textScaler.scale(1);
final int crossAxisCount = scaledFontSize > 20 ? 2 : 3;
return Column( return Column(
children: [ children: [
GridView.builder( GridView.builder(
physics: const NeverScrollableScrollPhysics(), physics: const NeverScrollableScrollPhysics(),
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 3, crossAxisCount: crossAxisCount,
crossAxisSpacing: 10.0, crossAxisSpacing: 10.0,
mainAxisSpacing: 10.0, mainAxisSpacing: 10.0,
childAspectRatio: 1, childAspectRatio: 1,

View File

@ -165,26 +165,31 @@ class _ScheduleProvisionalVisitPageWidgetState
memCacheHeight: 35, memCacheHeight: 35,
), ),
), ),
Padding( Expanded(
padding: const EdgeInsetsDirectional child: Padding(
.fromSTEB(15.0, 0.0, 0.0, 0.0), padding: const EdgeInsetsDirectional
child: Text( .fromSTEB(15.0, 0.0, 0.0, 0.0),
model.cliName, child: Text(
style: FlutterFlowTheme.of(context) model.cliName,
.bodyMedium overflow: TextOverflow.ellipsis,
.override( maxLines: 1,
fontFamily: style:
FlutterFlowTheme.of( FlutterFlowTheme.of(context)
context) .bodyMedium
.bodyMediumFamily, .override(
letterSpacing: 0.0, fontFamily:
useGoogleFonts: GoogleFonts FlutterFlowTheme.of(
.asMap() context)
.containsKey( .bodyMediumFamily,
FlutterFlowTheme.of( letterSpacing: 0.0,
context) useGoogleFonts: GoogleFonts
.bodyMediumFamily), .asMap()
), .containsKey(
FlutterFlowTheme.of(
context)
.bodyMediumFamily),
),
),
), ),
), ),
], ],

View File

@ -193,6 +193,12 @@ Theme wrapInMaterialTimePickerTheme(
required double iconSize, required double iconSize,
}) { }) {
final baseTheme = Theme.of(context); final baseTheme = Theme.of(context);
final textScaler = MediaQuery.textScalerOf(context);
final double baseFontSize = 14.0;
final double scaledFontSize = baseFontSize * textScaler.scale(1);
final double limitedFontSize = scaledFontSize > 14.0 ? 8 : scaledFontSize;
return Theme( return Theme(
data: baseTheme.copyWith( data: baseTheme.copyWith(
focusColor: headerBackgroundColor, focusColor: headerBackgroundColor,
@ -271,6 +277,10 @@ Theme wrapInMaterialTimePickerTheme(
dayPeriodBorderSide: BorderSide( dayPeriodBorderSide: BorderSide(
color: pickerForegroundColor, color: pickerForegroundColor,
), ),
dialTextStyle: baseTheme.textTheme.headlineMedium!.copyWith(
color: pickerDialForegroundColor,
fontSize: limitedFontSize,
),
dayPeriodTextColor: WidgetStateColor.resolveWith((states) => dayPeriodTextColor: WidgetStateColor.resolveWith((states) =>
states.contains(WidgetState.selected) states.contains(WidgetState.selected)
? selectedDateTimeForegroundColor ? selectedDateTimeForegroundColor

View File

@ -1,4 +1,3 @@
import 'package:flutter/gestures.dart'; import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart'; import 'package:google_fonts/google_fonts.dart';
@ -20,7 +19,7 @@ class HomePageWidget extends StatefulWidget {
State<HomePageWidget> createState() => _HomePageWidgetState(); State<HomePageWidget> createState() => _HomePageWidgetState();
} }
class _HomePageWidgetState extends State<HomePageWidget> { class _HomePageWidgetState extends State<HomePageWidget> {
late HomePageModel _model; late HomePageModel _model;
final scaffoldKey = GlobalKey<ScaffoldState>(); final scaffoldKey = GlobalKey<ScaffoldState>();
@ -30,13 +29,14 @@ class _HomePageWidgetState extends State<HomePageWidget> {
_localProfileComponentWidget = LocalProfileComponentWidget(); _localProfileComponentWidget = LocalProfileComponentWidget();
} }
@override void dispose() { @override
void dispose() {
super.dispose(); super.dispose();
_model.dispose(); _model.dispose();
} }
@override void initState() { @override
void initState() {
super.initState(); super.initState();
_model = createModel(context, () => HomePageModel()); _model = createModel(context, () => HomePageModel());
@ -48,9 +48,8 @@ class _HomePageWidgetState extends State<HomePageWidget> {
_model.textFieldFocusNode ??= FocusNode(); _model.textFieldFocusNode ??= FocusNode();
} }
@override
Widget build(BuildContext context) {
@override Widget build(BuildContext context) {
StorageUtil().context = context; StorageUtil().context = context;
return Scaffold( return Scaffold(
key: scaffoldKey, key: scaffoldKey,
@ -109,10 +108,6 @@ class _HomePageWidgetState extends State<HomePageWidget> {
); );
} }
Container buildPage(BuildContext context) { Container buildPage(BuildContext context) {
return Container( return Container(
decoration: BoxDecoration( decoration: BoxDecoration(