Skip to content

Commit 8d21fbc

Browse files
committed
fix: Changing to cupertino. #1
1 parent b75fc63 commit 8d21fbc

File tree

3 files changed

+25
-13
lines changed

3 files changed

+25
-13
lines changed

README.md

+13-9
Original file line numberDiff line numberDiff line change
@@ -98,14 +98,18 @@ we are going to add two different pages:
9898

9999
- the first page will showcase the implementation
100100
of the official `DatePicker` and `TimePicker`,
101-
the official Material widgets that are commonly used in `Flutter` apps.
102-
- the second page will pertain to **inline pickers**,
103-
meaning there won't be any dialogue/modals showing up
104-
and hijacking the screen
105-
whenever a person wishes to change date/time.
101+
the official **`Material`** widgets that are commonly used in `Flutter` apps.
102+
- the second page will pertain to **`Cupertino`** widgets.
106103

107104
> **Note:**
108105
>
106+
> We **do not like modals**.
107+
> Both of these widget types make use of modals/popups.
108+
> While we're wanting to build our own pickers that
109+
> *do not* use these as a crutch,
110+
> we'll have to settle for these *for now* to speed up the development
111+
> of our [`app`](https://github.com/dwyl/app).
112+
>
109113
> If you want to know *why* we're wanting to
110114
> **not** use modals,
111115
> visit https://github.com/dwyl/product-ux-research/issues/38 for more context.
@@ -151,7 +155,7 @@ class _HomePageState extends State<HomePage> {
151155
style: TextStyle(fontSize: 30, fontWeight: FontWeight.bold),
152156
),
153157
const Text(
154-
'Inline widget',
158+
'Cupertino widget',
155159
style: TextStyle(fontSize: 30, fontWeight: FontWeight.bold),
156160
)
157161
];
@@ -179,8 +183,8 @@ class _HomePageState extends State<HomePage> {
179183
label: 'Material',
180184
),
181185
BottomNavigationBarItem(
182-
icon: Icon(Icons.border_color),
183-
label: 'Inline',
186+
icon: Icon(Icons.power_input_sharp),
187+
label: 'Cupertino',
184188
),
185189
],
186190
currentIndex: _selectedIndex,
@@ -356,7 +360,7 @@ Change the `_pages` field so it uses this newly created page.
356360
final List<Widget> _pages = <Widget>[
357361
const MaterialExamplePage(),
358362
const Text(
359-
'Inline widget',
363+
'Cupertino widget',
360364
style: TextStyle(fontSize: 30, fontWeight: FontWeight.bold),
361365
)
362366
];

lib/main.dart

+3-3
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class _HomePageState extends State<HomePage> {
3131
final List<Widget> _pages = <Widget>[
3232
const MaterialExamplePage(),
3333
const Text(
34-
'Inline widget',
34+
'Cupertino widget',
3535
style: TextStyle(fontSize: 30, fontWeight: FontWeight.bold),
3636
)
3737
];
@@ -59,8 +59,8 @@ class _HomePageState extends State<HomePage> {
5959
label: 'Material',
6060
),
6161
BottomNavigationBarItem(
62-
icon: Icon(Icons.border_color),
63-
label: 'Inline',
62+
icon: Icon(Icons.power_input_sharp),
63+
label: 'Cupertino',
6464
),
6565
],
6666
currentIndex: _selectedIndex,

lib/material.dart

+9-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,15 @@ class _MaterialExamplePageState extends State<MaterialExamplePage> {
1717
Future<DateTime?> pickDate() => showDatePicker(context: context, initialDate: dateTime, firstDate: DateTime(1900), lastDate: DateTime(2100));
1818

1919
/// Opens time picker and returns possible `TimeOfDay` object.
20-
Future<TimeOfDay?> pickTime() => showTimePicker(context: context, initialTime: TimeOfDay(hour: dateTime.hour, minute: dateTime.minute));
20+
Future<TimeOfDay?> pickTime() => showTimePicker(
21+
context: context,
22+
initialTime: TimeOfDay(hour: dateTime.hour, minute: dateTime.minute),
23+
builder: (BuildContext context, Widget? child) {
24+
return MediaQuery(
25+
data: MediaQuery.of(context).copyWith(alwaysUse24HourFormat: true),
26+
child: child!,
27+
);
28+
});
2129

2230
/// Opens date picker and time picker consecutively and sets the `DateTime` field of the page.
2331
Future pickDateTime() async {

0 commit comments

Comments
 (0)