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
Container( | |
padding: EdgeInsets.symmetric(horizontal: 50, vertical: 30), | |
child: Column( | |
children: <Widget>[ | |
DropdownButton<String>( | |
isExpanded: true, | |
items: _states.map((String dropDownStringItem) { | |
return DropdownMenuItem<String>( | |
value: dropDownStringItem, | |
child: Text(dropDownStringItem), |
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
@override | |
void initState() { | |
_states = List.from(_states)..addAll(repo.getStates()); | |
super.initState(); | |
} |
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
class Home extends StatefulWidget { | |
@override | |
_HomeState createState() => _HomeState(); | |
} | |
class _HomeState extends State<Home> { | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( |
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'; | |
import 'package:states_lga/repository.dart'; | |
void main() => runApp(MyApp()); | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
title: 'Flutter Demo', |
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:states_lga/state_model.dart'; | |
class Repository { | |
List<Map> getAll() => _nigeria; | |
getLocalByState(String state) => _nigeria | |
.map((map) => StateModel.fromJson(map)) | |
.where((item) => item.state == state) | |
.map((item) => item.lgas) | |
.expand((i) => i) |
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
class StateModel { | |
String state; | |
String alias; | |
List<String> lgas; | |
StateModel({this.state, this.alias, this.lgas}); | |
StateModel.fromJson(Map<String, dynamic> json) { | |
state = json['state']; | |
alias = json['alias']; |
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
class Repository { | |
List<Map> getAll() => _nigeria; | |
getLocalByState(String state) => null | |
List<String> getStates() => null | |
List _nigeria = [ |
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
Positioned( | |
bottom: MediaQuery.of(context).size.height * .37, | |
left: MediaQuery.of(context).size.width * .05, | |
child: RaisedButton( | |
// padding: EdgeInsets.all(20), | |
padding: EdgeInsets.symmetric( | |
vertical: 18.0, | |
horizontal: 38.0, | |
), | |
color: Color(0xFFEE112D), |
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
Container( | |
height: MediaQuery.of(context).size.height, | |
width: MediaQuery.of(context).size.width, | |
child: ListView( | |
children: <Widget>[ | |
cryptoPortfolioItem(FontAwesomeIcons.btc, "BTC", 410.80, | |
0.0036, "82.19(92%)"), | |
cryptoPortfolioItem(FontAwesomeIcons.ethereum, "ETH", | |
1089.86, 126.0, "13.10(2.3%)"), | |
cryptoPortfolioItem(FontAwesomeIcons.xRay, "XRP", 22998.13, |
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
cryptoPortfolioItem(IconData icon, String name, double amount, double rate, | |
String percentage) => | |
Card( | |
elevation: 1.0, | |
child: InkWell( | |
onTap: () => print("tapped"), | |
child: Container( | |
padding: EdgeInsets.only(top: 15.0, bottom: 15.0, right: 15.0), | |
decoration: BoxDecoration( | |
color: Colors.white, |