Skip to content

Instantly share code, notes, and snippets.

@override
void initState() {
_states = List.from(_states)..addAll(repo.getStates());
super.initState();
}
class Home extends StatefulWidget {
@override
_HomeState createState() => _HomeState();
}
class _HomeState extends State<Home> {
@override
Widget build(BuildContext context) {
return Scaffold(
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',
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)
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'];
class Repository {
List<Map> getAll() => _nigeria;
getLocalByState(String state) => null
List<String> getStates() => null
List _nigeria = [
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),
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,
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,
Container(
alignment: Alignment.topCenter,
padding: new EdgeInsets.only(
top: MediaQuery.of(context).size.height * .25,
right: 10.0,
left: 10.0),
child: new Container(
height: MediaQuery.of(context).size.height,
width: MediaQuery.of(context).size.width,
),