File tree Expand file tree Collapse file tree 2 files changed +25
-7
lines changed Expand file tree Collapse file tree 2 files changed +25
-7
lines changed Original file line number Diff line number Diff line change 1
1
import 'package:flutter/material.dart' ;
2
2
import 'package:get/get.dart' ;
3
3
import 'package:symptom_tracker/screens/screens.dart' ;
4
+ import 'package:symptom_tracker/shared/action_button.dart' ;
4
5
import 'package:symptom_tracker/shared/app_bar.dart' ;
5
6
6
7
class HomeScreen extends StatelessWidget {
@@ -28,22 +29,18 @@ class HomeScreen extends StatelessWidget {
28
29
child: Column (
29
30
mainAxisAlignment: MainAxisAlignment .spaceEvenly,
30
31
children: [
31
- _buildActionButton (
32
+ SharedActionButton (
32
33
title: 'Dashboard' ,
33
34
onPressed: () => Get .to (DashboardScreen ()),
34
35
),
35
- _buildActionButton (
36
+ SharedActionButton (
36
37
title: 'Check-in' ,
37
38
onPressed: () => Get .to (CheckinScreen ()),
38
39
),
39
- _buildActionButton (title: 'FHIR' ),
40
+ SharedActionButton (title: 'FHIR' ),
40
41
Text ('Obligatory FHIR pun' ),
41
42
],
42
43
),
43
44
);
44
45
}
45
-
46
- Widget _buildActionButton ({@required String title, void Function () onPressed}) {
47
- return RaisedButton (child: Text (title), onPressed: onPressed);
48
- }
49
46
}
Original file line number Diff line number Diff line change
1
+ import 'package:flutter/material.dart' ;
2
+ import 'package:get/get.dart' ;
3
+
4
+ class SharedActionButton extends StatelessWidget {
5
+ final String title;
6
+ final void Function () onPressed;
7
+
8
+ const SharedActionButton ({Key key, @required this .title, this .onPressed}) : super (key: key);
9
+
10
+ @override
11
+ Widget build (BuildContext context) {
12
+ return ButtonTheme .fromButtonThemeData (
13
+ data: Get .theme.buttonTheme.copyWith (minWidth: Get .width / 2 ),
14
+ child: RaisedButton (
15
+ shape: RoundedRectangleBorder (borderRadius: BorderRadius .circular (30 )),
16
+ padding: const EdgeInsets .symmetric (horizontal: 32 , vertical: 24 ),
17
+ child: Text (title),
18
+ onPressed: onPressed),
19
+ );
20
+ }
21
+ }
You can’t perform that action at this time.
0 commit comments