import 'dart:math' as math; import 'package:flutter/material.dart'; void main() { runApp(new MyApp()); } class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return new MaterialApp( title: 'Road Services', theme: new ThemeData( primarySwatch: Colors.green, ), home: new MyHomePage(title: 'Road Services'), ); } } class MyDrawerHeader extends StatefulWidget { const MyDrawerHeader({ Key key }) : super(key: key); @override _MyDrawerHeaderState createState() => new _MyDrawerHeaderState(); } class _MyDrawerHeaderState extends State { bool _logoHasName = true; bool _logoHorizontal = true; Map _swatch = Colors.blue; @override Widget build(BuildContext context) { final double systemTopPadding = MediaQuery.of(context).padding.top; return new DrawerHeader( decoration: new FlutterLogoDecoration( margin: new EdgeInsets.fromLTRB(12.0, 12.0 + systemTopPadding, 12.0, 12.0), style: _logoHasName ? _logoHorizontal ? FlutterLogoStyle.horizontal : FlutterLogoStyle.stacked : FlutterLogoStyle.markOnly, swatch: _swatch, textColor: const Color(0xFF616161), ), duration: const Duration(milliseconds: 750), child: new GestureDetector( onLongPress: () { setState(() { _logoHorizontal = !_logoHorizontal; if (!_logoHasName) _logoHasName = true; }); }, onTap: () { setState(() { _logoHasName = !_logoHasName; }); }, onDoubleTap: () { setState(() { final List> options = >[]; if (_swatch != Colors.blue) options.addAll(>[Colors.blue, Colors.blue, Colors.blue, Colors.blue, Colors.blue, Colors.blue, Colors.blue]); if (_swatch != Colors.amber) options.addAll(>[Colors.amber, Colors.amber, Colors.amber]); if (_swatch != Colors.red) options.addAll(>[Colors.red, Colors.red, Colors.red]); if (_swatch != Colors.indigo) options.addAll(>[Colors.indigo, Colors.indigo, Colors.indigo]); if (_swatch != Colors.pink) options.addAll(>[Colors.pink]); if (_swatch != Colors.purple) options.addAll(>[Colors.purple]); if (_swatch != Colors.cyan) options.addAll(>[Colors.cyan]); _swatch = options[new math.Random().nextInt(options.length)]; }); } ) ); } } class MyHomePage extends StatefulWidget { MyHomePage({Key key, this.title}) : super(key: key); final String title; @override _MyHomePageState createState() => new _MyHomePageState(); } class _MyHomePageState extends State { bool _switch1 = true; bool _switch2 = false; double _slider = 0.2; @override Widget build(BuildContext context) { return new Scaffold( appBar: new AppBar( title: new Text(config.title), ), drawer: new Drawer( child: new Block( children: [ new MyDrawerHeader(), new AboutDrawerItem(), ], ), ), body: new Padding( padding: new EdgeInsets.all(16.0), child: new Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ new Expanded( child: new Card( child: new Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.stretch, children: [ new ListItem( leading: new Icon(Icons.local_gas_station), title: new Text('Gas Station'), onTap: () { }, ), new ListItem( leading: new Icon(Icons.local_grocery_store), title: new Text('Grocery Stores'), onTap: () { }, ), new ListItem( leading: new Icon(Icons.restaurant), title: new Text('Restaurants'), onTap: () { }, ), new ListItem( leading: new Icon(Icons.store_mall_directory), title: new Text('Stores'), onTap: () { }, ), new ListItem( leading: new Icon(Icons.build), title: new Text('Car mechanics'), onTap: () { }, ), ], ), ), ), new Expanded( child: new Column( children: [ new Card( child: new Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.stretch, children: [ new ListItem( leading: new Icon(Icons.traffic), title: new Text('Traffic Lights'), trailing: new Switch( value: _switch1, onChanged: (bool value) { setState(() { _switch1 = value; }); }, ), onTap: () { setState(() { _switch1 = !_switch1; }); }, ), new ListItem( leading: new Icon(Icons.local_car_wash), title: new Text('Car Wash'), trailing: new Switch( value: _switch2, onChanged: (bool value) { setState(() { _switch2 = value; }); }, ), onTap: () { setState(() { _switch2 = !_switch2; }); }, ), ], ), ), new Card( child: new Padding( padding: new EdgeInsets.all(12.0), child: new Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.stretch, children: [ new Text('Price Multiplier'), new Slider( value: _slider, onChanged: (double value) { setState(() { _slider = value; }); }, ), new Padding( padding: new EdgeInsets.all(8.0), child: new Center( child: new RaisedButton( color: Theme.of(context).primaryColor, colorBrightness: Theme.of(context).primaryColorBrightness, onPressed: () { }, child: new Text('DISTRIBUTE GIFTS'), ), ), ), ], ), ), ), ], ), ), ], ), ), floatingActionButton: new FloatingActionButton( onPressed: () { }, child: new Icon(Icons.share), ), ); } }