2021-08-23 07:59:30 +03:00
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
import 'package:info_tren/pages/main/main_page.dart';
|
|
|
|
|
|
|
|
class MainPageCupertino extends MainPageShared {
|
2022-10-31 01:49:11 +01:00
|
|
|
const MainPageCupertino({super.key});
|
|
|
|
|
2021-08-23 07:59:30 +03:00
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return CupertinoPageScaffold(
|
|
|
|
navigationBar: CupertinoNavigationBar(
|
|
|
|
middle: Text(pageTitle),
|
2022-08-04 03:45:32 +03:00
|
|
|
trailing: CupertinoButton(
|
|
|
|
padding: EdgeInsets.zero,
|
|
|
|
onPressed: () {
|
|
|
|
showCupertinoModalPopup(
|
|
|
|
context: context,
|
|
|
|
builder: (context) {
|
|
|
|
return CupertinoActionSheet(
|
|
|
|
actions: popupMenu.map((m) => CupertinoActionSheetAction(
|
|
|
|
onPressed: () {
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
m.action?.call(context);
|
|
|
|
},
|
|
|
|
child: Text(m.name),
|
|
|
|
)).toList(),
|
|
|
|
cancelButton: CupertinoActionSheetAction(
|
|
|
|
onPressed: () {
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
},
|
2022-10-31 01:30:29 +01:00
|
|
|
child: const Text('Anulare'),
|
2022-08-04 03:45:32 +03:00
|
|
|
),
|
|
|
|
);
|
|
|
|
},
|
|
|
|
);
|
|
|
|
},
|
2022-10-31 01:30:29 +01:00
|
|
|
child: const Icon(CupertinoIcons.ellipsis_circle),
|
2022-08-04 03:45:32 +03:00
|
|
|
),
|
2021-08-23 07:59:30 +03:00
|
|
|
),
|
|
|
|
child: SafeArea(
|
|
|
|
child: Center(
|
|
|
|
child: Column(
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
children: options.map((option) => CupertinoButton.filled(
|
2022-10-31 01:30:29 +01:00
|
|
|
onPressed: option.action == null ? null : () => option.action!(context),
|
2022-08-06 00:27:46 +03:00
|
|
|
child: Text.rich(
|
|
|
|
TextSpan(
|
|
|
|
children: [
|
|
|
|
TextSpan(text: option.name),
|
|
|
|
if (option.description != null) ...[
|
2022-10-31 01:30:29 +01:00
|
|
|
const TextSpan(text: '\n'),
|
2022-08-06 00:27:46 +03:00
|
|
|
TextSpan(
|
|
|
|
text: option.description,
|
2022-10-31 01:30:29 +01:00
|
|
|
style: const TextStyle(
|
2022-08-06 00:27:46 +03:00
|
|
|
inherit: true,
|
|
|
|
fontSize: 14,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
),
|
2021-08-23 07:59:30 +03:00
|
|
|
)).map((w) => Padding(
|
|
|
|
padding: const EdgeInsets.fromLTRB(4, 2, 4, 2),
|
|
|
|
child: SizedBox(
|
|
|
|
width: double.infinity,
|
|
|
|
child: w,
|
|
|
|
),
|
|
|
|
)).toList(),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|