Created
April 20, 2020 21:39
-
-
Save TobiCrackIT/86b73b02654f94675e7a7a1461d8a599 to your computer and use it in GitHub Desktop.
Flutter Tutorial on the use of select widgets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
void main() => runApp(MyApp()); | |
class MyApp extends StatelessWidget { | |
// This widget is the root of your application. | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
title: 'Custom5', | |
theme: ThemeData( | |
primarySwatch: Colors.blue, | |
), | |
home: Custom(), | |
); | |
} | |
} | |
class Custom extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
backgroundColor: Colors.white, | |
appBar: AppBar( | |
backgroundColor: Colors.deepOrangeAccent, | |
title: Text('Building Widgets'), | |
actions: <Widget>[ | |
Padding( | |
padding: const EdgeInsets.only(right: 10), | |
child: Icon( | |
Icons.search, | |
color: Colors.white, | |
), | |
), | |
Padding( | |
padding: const EdgeInsets.only(right: 10), | |
child: Icon( | |
Icons.more_vert, | |
color: Colors.white, | |
), | |
) | |
], | |
), | |
body: Container( | |
child: Column( | |
children: <Widget>[ | |
ListTile( | |
leading: FlutterLogo(), | |
title: Text( | |
'Fluttering Flutter', | |
style: TextStyle( | |
fontSize: 14, | |
fontWeight: FontWeight.w500, | |
color: Colors.black), | |
), | |
subtitle: Row( | |
mainAxisAlignment: MainAxisAlignment.start, | |
crossAxisAlignment: CrossAxisAlignment.center, | |
children: <Widget>[ | |
Text( | |
'+234 812 345 6789: ', | |
style: TextStyle( | |
fontSize: 14, | |
fontWeight: FontWeight.w400, | |
color: Colors.grey), | |
), | |
Expanded( | |
child: Text( | |
'Flutter is interesting!', | |
style: TextStyle( | |
fontSize: 14, | |
fontWeight: FontWeight.w400, | |
color: Colors.grey), | |
overflow: TextOverflow.ellipsis, | |
maxLines: 1, | |
), | |
) | |
], | |
), | |
trailing: Text( | |
'10:08 PM', | |
style: TextStyle( | |
fontSize: 14, | |
fontWeight: FontWeight.w400, | |
color: Colors.grey), | |
), | |
), | |
SizedBox( | |
height: 20, | |
), | |
FlatButton( | |
onPressed: () { | |
print('This BUTTON is useless'); | |
}, | |
child: Text( | |
'DO NOTHING', | |
style: TextStyle(color: Colors.deepOrangeAccent, fontSize: 16), | |
), | |
splashColor: Colors.deepOrangeAccent, | |
), | |
IconButton( | |
icon: Icon( | |
Icons.arrow_back, | |
color: Colors.black, | |
), | |
onPressed: () { | |
print('I am an IconButton'); | |
}), | |
Image.network( | |
'https://picsum.photos/250?image=9', | |
), | |
], | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment