Created
December 12, 2020 12:59
-
-
Save Vetjurv4/4e2edb14d7997aec91a7fd01c071cb6a to your computer and use it in GitHub Desktop.
List countries view
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 { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
debugShowCheckedModeBanner: false, | |
title: 'ListViews', | |
theme: ThemeData( | |
primarySwatch: Colors.teal, | |
), //theme data | |
home: Scaffold( | |
appBar: AppBar(title: Text('ListViews')), //app bar | |
body: Column( | |
children: [ | |
SizedBox(height: 10), | |
Card( | |
margin: EdgeInsets.all(5), | |
child: TextField( | |
decoration: InputDecoration( | |
contentPadding: EdgeInsets.symmetric(horizontal: 10), | |
suffixIcon: Icon(Icons.close), | |
border: OutlineInputBorder( | |
borderRadius: BorderRadius.circular(5.0)), | |
labelText: "Search", | |
), | |
), | |
), //card | |
Expanded( | |
child: ListView( | |
children: | |
ListTile.divideTiles( | |
context: context, | |
tiles: [ | |
ListTile( | |
leading: Image( | |
image: NetworkImage('https://upload.wikimedia.org/wikipedia/en/a/ae/Flag_of_the_United_Kingdom.svg'), | |
), | |
title: Text('South Africa', style: TextStyle(fontWeight: FontWeight.bold)), | |
subtitle: Text('something'), | |
trailing: Icon(Icons.keyboard_arrow_right), | |
), | |
ListTile( | |
leading: Image( | |
image: NetworkImage('https://upload.wikimedia.org/wikipedia/en/a/ae/Flag_of_the_United_Kingdom.svg'), | |
), | |
title: Text('Madagascar', style: TextStyle(fontWeight: FontWeight.bold)), | |
subtitle: Text('something'), | |
trailing: Icon(Icons.keyboard_arrow_right), | |
), | |
ListTile( | |
leading: Image( | |
image: NetworkImage('https://upload.wikimedia.org/wikipedia/en/a/ae/Flag_of_the_United_Kingdom.svg'), | |
), | |
title: Text('Uganda', style: TextStyle(fontWeight: FontWeight.bold)), | |
subtitle: Text('something'), | |
trailing: Icon(Icons.keyboard_arrow_right), | |
), | |
], //tiles | |
).toList(), //ListTile | |
), //list view | |
) //expanded | |
], //children | |
), //column | |
), //scafold | |
); //material app | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment