You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
75 lines
2.4 KiB
75 lines
2.4 KiB
import 'package:flutter/cupertino.dart'; |
|
import 'package:info_tren/pages/main/main_page.dart'; |
|
|
|
class MainPageCupertino extends MainPageShared { |
|
const MainPageCupertino({super.key}); |
|
|
|
@override |
|
Widget build(BuildContext context) { |
|
return CupertinoPageScaffold( |
|
navigationBar: CupertinoNavigationBar( |
|
middle: Text(pageTitle), |
|
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(); |
|
}, |
|
child: const Text('Anulare'), |
|
), |
|
); |
|
}, |
|
); |
|
}, |
|
child: const Icon(CupertinoIcons.ellipsis_circle), |
|
), |
|
), |
|
child: SafeArea( |
|
child: Center( |
|
child: Column( |
|
mainAxisSize: MainAxisSize.min, |
|
children: options.map((option) => CupertinoButton.filled( |
|
onPressed: option.action == null ? null : () => option.action!(context), |
|
child: Text.rich( |
|
TextSpan( |
|
children: [ |
|
TextSpan(text: option.name), |
|
if (option.description != null) ...[ |
|
const TextSpan(text: '\n'), |
|
TextSpan( |
|
text: option.description, |
|
style: const TextStyle( |
|
inherit: true, |
|
fontSize: 14, |
|
), |
|
), |
|
], |
|
], |
|
), |
|
textAlign: TextAlign.center, |
|
), |
|
)).map((w) => Padding( |
|
padding: const EdgeInsets.fromLTRB(4, 2, 4, 2), |
|
child: SizedBox( |
|
width: double.infinity, |
|
child: w, |
|
), |
|
)).toList(), |
|
), |
|
), |
|
), |
|
); |
|
} |
|
}
|
|
|