Skip to content

Commit c410739

Browse files
author
Julian Currie
committed
added custom CheetahButton and CheetahWidgets
1 parent 6d1953e commit c410739

File tree

5 files changed

+72
-4
lines changed

5 files changed

+72
-4
lines changed

android/app/src/main/AndroidManifest.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424
<meta-data
2525
android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
2626
android:value="true" />
27+
<meta-data
28+
android:name="flutterEmbedding"
29+
android:value="2" />
2730
<intent-filter>
2831
<action android:name="android.intent.action.MAIN"/>
2932
<category android:name="android.intent.category.LAUNCHER"/>

lib/main.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ class MyApp extends StatelessWidget {
77
@override
88
Widget build(BuildContext context) {
99
return MaterialApp(
10+
debugShowCheckedModeBanner: false,
1011
theme: ThemeData(
1112
appBarTheme: AppBarTheme(color: Color(0xFFe67e00)),
1213
),

lib/screens/home.dart

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,7 @@ class Home extends StatelessWidget {
1212
child: Column(
1313
mainAxisAlignment: MainAxisAlignment.center,
1414
children: <Widget>[
15-
Image.asset(
16-
'assets/images/logo.png',
17-
height: 200,
18-
),
15+
Image.asset('assets/images/logo.png', height: 200),
1916
SizedBox(height: 24),
2017
Text(
2118
'Master Branch',

lib/widget/cheetah_button.dart

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import 'package:flutter/material.dart';
2+
3+
class CheetahButton extends StatelessWidget {
4+
final String text;
5+
final Function onPressed;
6+
final Color? color;
7+
final Color? textColor;
8+
9+
CheetahButton({
10+
required this.text,
11+
required this.onPressed,
12+
this.color,
13+
this.textColor,
14+
});
15+
16+
@override
17+
Widget build(BuildContext context) {
18+
return Expanded(
19+
child: TextButton(
20+
style: TextButton.styleFrom(
21+
padding: EdgeInsets.all(16),
22+
elevation: 8,
23+
backgroundColor: color ?? Theme.of(context).primaryColor,
24+
shape: RoundedRectangleBorder(
25+
borderRadius: BorderRadius.all(Radius.circular(10)),
26+
),
27+
),
28+
child: Text(
29+
text,
30+
style: TextStyle(
31+
fontSize: 16,
32+
color: textColor ?? Colors.white,
33+
),
34+
),
35+
onPressed: onPressed(),
36+
),
37+
);
38+
}
39+
}

lib/widget/cheetah_input.dart

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import 'package:flutter/material.dart';
2+
3+
class CheetahInput extends StatelessWidget {
4+
final String labelText;
5+
final Function onSaved;
6+
7+
CheetahInput({@required this.labelText, @required this.onSaved});
8+
9+
@override
10+
Widget build(BuildContext context) {
11+
return TextFormField(
12+
decoration: InputDecoration(
13+
fillColor: Colors.white,
14+
filled: true,
15+
labelText: labelText,
16+
border: OutlineInputBorder(
17+
borderRadius: BorderRadius.circular(16),
18+
),
19+
floatingLabelBehavior: FloatingLabelBehavior.never,
20+
),
21+
initialValue: '',
22+
validator: (String value) {
23+
return value.isEmpty ? '$labelText is required' : null;
24+
},
25+
onSaved: onSaved(),
26+
);
27+
}
28+
}

0 commit comments

Comments
 (0)