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/services/localization/localization_service.dart';
class MenuButtonWidget extends MenuEntry {
const MenuButtonWidget({
super.key,
@ -32,34 +31,41 @@ class _MenuButtonWidgetState extends State<MenuButtonWidget> {
get action => action;
bool _isProcessing = false;
@override
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(
splashColor: Colors.transparent,
focusColor: Colors.transparent,
hoverColor: Colors.transparent,
highlightColor: Colors.transparent,
onTap: _isProcessing ? null : () async {
setState(() {
_isProcessing = true;
});
await LocalizationService.processLocals(context).then((value) async {
if (value) {
await widget.action?.call();
} else {
DialogUnavailable.unavailableCredentials(context);
}
});
setState(() {
_isProcessing = false;
});
},
onTap: _isProcessing
? null
: () async {
setState(() {
_isProcessing = true;
});
await LocalizationService.processLocals(context)
.then((value) async {
if (value) {
await widget.action?.call();
} else {
DialogUnavailable.unavailableCredentials(context);
}
});
setState(() {
_isProcessing = false;
});
},
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 0, vertical: 0),
child: Container(
width: 120.0,
height: 100.0,
width: 300,
height: 280,
decoration: BoxDecoration(
color: FlutterFlowTheme.of(context).primaryBackground,
boxShadow: [
@ -107,7 +113,7 @@ class _MenuButtonWidgetState extends State<MenuButtonWidget> {
style: FlutterFlowTheme.of(context).titleLarge.override(
fontFamily: 'Nunito',
color: FlutterFlowTheme.of(context).primaryText,
fontSize: 14.0,
fontSize: limitedFontSize,
letterSpacing: 0.0,
fontWeight: FontWeight.w500,
useGoogleFonts:

View File

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

View File

@ -39,8 +39,8 @@ class _LocalProfileComponentWidgetState
//
// WidgetsBinding.instance
// .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
@ -57,10 +57,13 @@ class _LocalProfileComponentWidgetState
});
}
@override
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(
decoration: const BoxDecoration(),
child: Align(
@ -90,7 +93,8 @@ class _LocalProfileComponentWidgetState
hoverColor: Colors.transparent,
highlightColor: Colors.transparent,
onTap: () async {
await LocalizationService.selectLocal(context).then((value) => value == true ? onUpdate() : null);
await LocalizationService.selectLocal(context).then(
(value) => value == true ? onUpdate() : null);
},
child: ClipRRect(
borderRadius: BorderRadius.circular(200.0),
@ -120,23 +124,36 @@ class _LocalProfileComponentWidgetState
)),
),
),
Text(
valueOrDefault<String>(
functions.convertToUppercase(_model.cliName),
FFLocalizations.of(context).getVariableText(
ptText: 'SEM LOCAL VINCULADO',
enText: 'NO LINKED LOCAL',
Expanded(
child: Tooltip(
message: valueOrDefault<String>(
functions.convertToUppercase(_model.cliName),
FFLocalizations.of(context).getVariableText(
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))

View File

@ -52,12 +52,16 @@ class _MenuStaggeredViewComponentWidgetState
@override
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(
children: [
GridView.builder(
physics: const NeverScrollableScrollPhysics(),
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 3,
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: crossAxisCount,
crossAxisSpacing: 10.0,
mainAxisSpacing: 10.0,
childAspectRatio: 1,

View File

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

View File

@ -193,6 +193,12 @@ Theme wrapInMaterialTimePickerTheme(
required double iconSize,
}) {
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(
data: baseTheme.copyWith(
focusColor: headerBackgroundColor,
@ -271,6 +277,10 @@ Theme wrapInMaterialTimePickerTheme(
dayPeriodBorderSide: BorderSide(
color: pickerForegroundColor,
),
dialTextStyle: baseTheme.textTheme.headlineMedium!.copyWith(
color: pickerDialForegroundColor,
fontSize: limitedFontSize,
),
dayPeriodTextColor: WidgetStateColor.resolveWith((states) =>
states.contains(WidgetState.selected)
? selectedDateTimeForegroundColor

View File

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