2019-10-02 08:58:11 +02:00
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
import 'package:git_touch/models/theme.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
|
|
|
class CommonScaffold extends StatelessWidget {
|
2022-09-06 18:28:12 +02:00
|
|
|
const CommonScaffold({
|
2021-05-16 09:16:35 +02:00
|
|
|
required this.title,
|
|
|
|
required this.body,
|
2019-10-02 08:58:11 +02:00
|
|
|
this.action,
|
|
|
|
});
|
2022-09-21 18:28:21 +02:00
|
|
|
final Widget title;
|
|
|
|
final Widget body;
|
|
|
|
final Widget? action;
|
2019-10-02 08:58:11 +02:00
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2019-11-08 10:24:00 +01:00
|
|
|
final theme = Provider.of<ThemeModel>(context);
|
2020-01-16 05:45:04 +01:00
|
|
|
// FIXME: A hack to get brightness before MaterialApp been built
|
|
|
|
theme.setSystemBrightness(MediaQuery.of(context).platformBrightness);
|
2019-11-08 10:24:00 +01:00
|
|
|
|
2022-09-17 14:35:45 +02:00
|
|
|
return CupertinoPageScaffold(
|
|
|
|
navigationBar: CupertinoNavigationBar(
|
|
|
|
middle: title,
|
|
|
|
trailing: action,
|
|
|
|
),
|
|
|
|
child: SafeArea(child: body),
|
|
|
|
);
|
2019-10-02 08:58:11 +02:00
|
|
|
}
|
|
|
|
}
|