appBarWeebiUpdateNotSaved function
Implementation
PreferredSizeWidget appBarWeebiUpdateNotSaved(String title,
{Color? backgroundColor,
List<Widget>? actions,
String pushThatRouteInstead = ''}) {
return AppBar(
backgroundColor: backgroundColor,
leading: Builder(
builder: (BuildContext context) {
return IconButton(
tooltip: MaterialLocalizations.of(context).openAppDrawerTooltip,
icon: const Icon(Icons.arrow_back),
onPressed: () async {
final isSureAboutQuitting =
await AskDialog.areYouSureUpdateNotSaved(context);
if (isSureAboutQuitting) {
if (pushThatRouteInstead.isNotEmpty) {
Navigator.of(context).popAndPushNamed(pushThatRouteInstead);
} else {
Navigator.of(context).pop();
}
}
},
);
},
),
title: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Text(title, textAlign: TextAlign.start),
],
),
actions: actions ?? [],
);
}