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,19 +31,26 @@ 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 {
onTap: _isProcessing
? null
: () async {
setState(() {
_isProcessing = true;
});
await LocalizationService.processLocals(context).then((value) async {
await LocalizationService.processLocals(context)
.then((value) async {
if (value) {
await widget.action?.call();
} else {
@ -58,8 +64,8 @@ class _MenuButtonWidgetState extends State<MenuButtonWidget> {
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,11 +36,14 @@ class _MenuCardItemState extends State<MenuCardItem> {
focusColor: Colors.transparent,
hoverColor: Colors.transparent,
highlightColor: Colors.transparent,
onTap: _isProcessing ? null : () async {
onTap: _isProcessing
? null
: () async {
setState(() {
_isProcessing = true;
});
await LocalizationService.processLocals(context).then((value) async {
await LocalizationService.processLocals(context)
.then((value) async {
if (value) {
await widget.action?.call();
} else {

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,7 +124,16 @@ class _LocalProfileComponentWidgetState
)),
),
),
Text(
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(
@ -128,16 +141,20 @@ class _LocalProfileComponentWidgetState
enText: 'NO LINKED LOCAL',
),
),
overflow: TextOverflow.ellipsis,
maxLines: 1,
style: FlutterFlowTheme.of(context).labelMedium.override(
fontFamily: 'Nunito',
color: FlutterFlowTheme.of(context).info,
fontSize: 14.0,
fontSize: limitedFontSize,
letterSpacing: 0.0,
fontWeight: FontWeight.w500,
useGoogleFonts:
GoogleFonts.asMap().containsKey('Nunito'),
),
),
),
),
]
.divide(const SizedBox(width: 20.0))
.addToStart(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,12 +165,16 @@ class _ScheduleProvisionalVisitPageWidgetState
memCacheHeight: 35,
),
),
Padding(
Expanded(
child: Padding(
padding: const EdgeInsetsDirectional
.fromSTEB(15.0, 0.0, 0.0, 0.0),
child: Text(
model.cliName,
style: FlutterFlowTheme.of(context)
overflow: TextOverflow.ellipsis,
maxLines: 1,
style:
FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily:
@ -187,6 +191,7 @@ class _ScheduleProvisionalVisitPageWidgetState
),
),
),
),
],
),
),

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';
@ -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(