Flutter upgrade

This commit is contained in:
Hillel Coren 2023-12-17 13:18:02 +02:00
parent d5388e5567
commit b1a7444a61
6 changed files with 440 additions and 464 deletions

View File

@ -123,11 +123,7 @@ class EditScaffold extends StatelessWidget {
final showOverflow = isDesktop(context) && state.isFullScreen;
return WillPopScope(
onWillPop: () async {
return true;
},
child: CallbackShortcuts(
return CallbackShortcuts(
bindings: <ShortcutActivator, VoidCallback>{
const SingleActivator(LogicalKeyboardKey.keyS, control: true): () =>
onSavePressed!(context),
@ -190,8 +186,7 @@ class EditScaffold extends StatelessWidget {
entity != null &&
entity!.isOld) ...[
EntityStatusChip(
entity:
state.getEntity(entity!.entityType, entity!.id)),
entity: state.getEntity(entity!.entityType, entity!.id)),
SizedBox(width: 8),
],
if (showOverflow)
@ -226,8 +221,7 @@ class EditScaffold extends StatelessWidget {
: null,
child: ConstrainedBox(
constraints: BoxConstraints(
minWidth:
isDesktop(context) ? 60 : 0),
minWidth: isDesktop(context) ? 60 : 0),
child: isDesktop(context)
? IconText(
icon: getEntityActionIcon(action),
@ -272,8 +266,8 @@ class EditScaffold extends StatelessWidget {
builder: (context, remaining) {
return PopupMenuButton<EntityAction>(
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 8),
padding:
const EdgeInsets.symmetric(horizontal: 8),
child: isDesktop(context)
? Row(
children: [
@ -294,8 +288,7 @@ class EditScaffold extends StatelessWidget {
itemBuilder: (BuildContext context) {
return entityActions
.toList()
.sublist(
entityActions.length - remaining)
.sublist(entityActions.length - remaining)
.map((action) {
return PopupMenuItem<EntityAction>(
value: action,
@ -330,8 +323,7 @@ class EditScaffold extends StatelessWidget {
child: SizedBox(
width: 26,
height: 26,
child:
CircularProgressIndicator(color: Colors.white),
child: CircularProgressIndicator(color: Colors.white),
)),
)
else if (isDesktop(context))
@ -363,10 +355,8 @@ class EditScaffold extends StatelessWidget {
OutlinedButton(
style: isEnabled
? ButtonStyle(
backgroundColor:
MaterialStateProperty.all(state
.prefState
.colorThemeModel!
backgroundColor: MaterialStateProperty.all(
state.prefState.colorThemeModel!
.colorSuccess))
: null,
onPressed: !isEnabled ||
@ -466,12 +456,10 @@ class EditScaffold extends StatelessWidget {
: appBarBottom as PreferredSizeWidget?,
),
bottomNavigationBar: bottomNavigationBar,
floatingActionButtonLocation:
FloatingActionButtonLocation.endDocked,
floatingActionButtonLocation: FloatingActionButtonLocation.endDocked,
floatingActionButton: floatingActionButton,
),
),
),
);
}
}

View File

@ -124,10 +124,10 @@ class ListScaffold extends StatelessWidget {
],
);
return WillPopScope(
onWillPop: () async {
return PopScope(
canPop: false,
onPopInvoked: (_) {
store.dispatch(ViewDashboard());
return false;
},
child: FocusTraversalGroup(
child: Scaffold(

View File

@ -258,8 +258,9 @@ class MainScreen extends StatelessWidget {
print('## Error: main screen route $mainRoute not defined');
}
return WillPopScope(
onWillPop: () async {
return PopScope(
canPop: false,
onPopInvoked: (_) async {
final state = store.state;
final historyList = state.historyList;
final isEditing = state.uiState.isEditing;
@ -268,7 +269,6 @@ class MainScreen extends StatelessWidget {
if (state.uiState.isPreviewing) {
store.dispatch(PopPreviewStack());
return false;
}
for (int i = index; i < historyList.length; i++) {
@ -300,9 +300,7 @@ class MainScreen extends StatelessWidget {
if (history == null) {
store.dispatch(ViewDashboard());
return false;
}
} else {
switch (history.entityType) {
case EntityType.dashboard:
store.dispatch(ViewDashboard());
@ -330,8 +328,7 @@ class MainScreen extends StatelessWidget {
);
}
}
return false;
}
},
child: DesktopSessionTimeout(
child: SafeArea(

View File

@ -89,11 +89,7 @@ class ViewScaffold extends StatelessWidget {
}
}
return WillPopScope(
onWillPop: () async {
return true;
},
child: FocusTraversalGroup(
return FocusTraversalGroup(
child: Scaffold(
backgroundColor: Theme.of(context).cardColor,
appBar: AppBar(
@ -152,10 +148,8 @@ class ViewScaffold extends StatelessWidget {
],
),
body: SafeArea(
child: entity.isNew
? BlankScreen(localization!.noRecordSelected)
: body,
),
child:
entity.isNew ? BlankScreen(localization!.noRecordSelected) : body,
),
),
);

View File

@ -373,9 +373,7 @@ class _DashboardScreenState extends State<DashboardScreen>
),
);
return WillPopScope(
onWillPop: () async => true,
child: isDesktop(context)
return isDesktop(context)
? Row(
children: [
Flexible(
@ -394,8 +392,7 @@ class _DashboardScreenState extends State<DashboardScreen>
),
],
)
: mainScaffold,
);
: mainScaffold;
}
}

View File

@ -326,10 +326,10 @@ class ReportsScreen extends StatelessWidget {
),
];
return WillPopScope(
onWillPop: () async {
return PopScope(
canPop: false,
onPopInvoked: (_) {
store.dispatch(ViewDashboard());
return false;
},
child: Scaffold(
drawer: isMobile(context) || state.prefState.isMenuFloated