Initial commit

This commit is contained in:
vjrj 2018-06-08 11:30:33 +02:00
commit c4438365ab
78 changed files with 1900 additions and 0 deletions

34
lib/activeFires.dart Normal file
View file

@ -0,0 +1,34 @@
import 'package:flutter/material.dart';
import 'mainDrawer.dart';
class ActiveFiresMap extends StatelessWidget {
static const String routeName = '/fires';
final GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey<ScaffoldState>();
@override
Widget build(BuildContext context) {
return Scaffold(
key: _scaffoldKey,
drawer: new MainDrawer(context),
appBar: new AppBar(
title: Text('Active fires'),
leading: IconButton(
icon: Icon(Icons.menu),
onPressed: () {
_scaffoldKey.currentState.openDrawer();
},
),
actions: <Widget>[
new IconButton(
icon: Icon(Icons.location_searching), onPressed: () => {}),
IconButton(
icon: Icon(Icons.more_vert),
onPressed: () {
print('More button');
},
),
],
),
body: new Text('No active fires'));
}
}

58
lib/addZone.dart Normal file
View file

@ -0,0 +1,58 @@
import 'package:flutter/material.dart';
import 'colors.dart';
import 'package:comunes_flutter/comunes_flutter.dart';
class HomePage extends StatelessWidget {
static const String routeName = '/home';
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(
title: const Text('Add area'),
actions: <Widget>[
IconButton(
icon: Icon(Icons.edit),
onPressed: () {
print('Filter button');
},
),
],
),
// https://flutter.io/widgets/scrolling/
floatingActionButton:
Column(mainAxisAlignment: MainAxisAlignment.end, children: <Widget>[
FloatingActionButton(
onPressed: () {
//
},
heroTag: 'image0',
tooltip: 'Pick Image from gallery',
child: const Icon(Icons.photo_library),
),
]),
body: new SingleChildScrollView(
child: new Column(
children: <Widget>[
new Padding(
padding: const EdgeInsets.all(16.0),
child: new Column(
children: <Widget>[
SizedBox(height: 10.0),
new TextFormField(
decoration: new InputDecoration(
border: const OutlineInputBorder(),
helperText: "Write a place to center the map",
hintText: 'Write here a place',
labelText: 'Your location')),
SizedBox(height: 20.0),
],
),
)
],
)),
);
}
}

11
lib/colors.dart Normal file
View file

@ -0,0 +1,11 @@
import 'package:flutter/material.dart';
const fires50 = const Color(0xFFFBE9E7);
const fires100 = const Color(0xFFFFCCBC);
const fires300 = const Color(0xFFFF8A65);
const fires600 = const Color(0xFFF4511E);
const fires900 = const Color(0xFFBF360C);
const firesErrorRed = const Color(0xFFDD2C00);
const firesSurfaceWhite = fires50;
const firesBackgroundWhite = Colors.white;

26
lib/firesApp.dart Normal file
View file

@ -0,0 +1,26 @@
import 'package:flutter/material.dart';
import 'package:comunes_flutter/comunes_flutter.dart';
import 'homePage.dart';
import 'theme.dart';
import 'introPage.dart';
import 'sandbox.dart';
import 'activeFires.dart';
class FiresApp extends StatelessWidget {
final Map routes = <String, WidgetBuilder>{
Sandbox.routeName: (BuildContext context) => new Sandbox(),
ActiveFiresMap.routeName: (BuildContext context) => new ActiveFiresMap(),
IntroPage.routeName: (BuildContext context) => new IntroPage(),
};
final WidgetBuilder introWidget = (context) => new IntroPage();
final WidgetBuilder continueWidget = (context) => new HomePage();
@override
Widget build(BuildContext context) {
return new MaterialApp(
home: new MaterialAppWithIntroHome(introWidget, continueWidget),
title: 'All Against The Fire!',
theme: firesTheme,
routes: routes);
}
}

73
lib/homePage.dart Normal file
View file

@ -0,0 +1,73 @@
import 'package:flutter/material.dart';
import 'colors.dart';
import 'package:comunes_flutter/comunes_flutter.dart';
import 'mainDrawer.dart';
import 'activeFires.dart';
class HomePage extends StatelessWidget {
static const String routeName = '/home';
final _btnFont = const TextStyle(
fontSize: 20.0,
// fontWeight: FontWeight.w500,
color: Colors.white,
);
@override
Widget build(BuildContext context) {
return new Scaffold(
drawer: new MainDrawer(context),
body: new SafeArea(
child: Center(
child: new CenteredColumn(children: <Widget>[
new Expanded(
child: new FractionallySizedBox(
alignment: FractionalOffset.bottomCenter,
heightFactor: 0.8,
child: new Image.asset('images/logo-200.png',
fit: BoxFit.fitHeight))),
new Expanded(
child: new FractionallySizedBox(
alignment: FractionalOffset.topCenter,
heightFactor: 0.9,
child: new CenteredColumn(
children: <Widget>[
customBtn(
Icons.whatshot,
"Active fires",
context,
// const EdgeInsets.only(left: 60.0),
ActiveFiresMap.routeName),
],
)))
])),
));
}
SizedBox customBtn(IconData icon, String text, BuildContext context, route) {
final btnRadius = new Radius.circular(90.0);
return new SizedBox(
// width: double.infinity,
child: new RaisedButton(
elevation: 1.0,
color: fires600,
child: new Padding(
padding: const EdgeInsets.all(10.0),
child: new Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
new Icon(icon, size: 32.0, color: Colors.white),
new SizedBox(width: 10.0),
new Text(text, style: _btnFont),
],
),
),
onPressed: () {
Navigator.pushNamed(context, route);
},
shape: new RoundedRectangleBorder(
borderRadius: BorderRadius.all(btnRadius))),
);
}
}

27
lib/introPage.dart Normal file
View file

@ -0,0 +1,27 @@
import 'package:comunes_flutter/comunes_flutter.dart';
import 'package:flutter/material.dart';
import 'homePage.dart';
class IntroPage extends AppIntroPage {
static const String routeName = '/intro';
static final List<AppIntroItem> fireItems = <AppIntroItem>[
AppIntroItem(icon: Icons.location_on, title: 'Choose a place'),
AppIntroItem(icon: Icons.panorama_fish_eye, title: 'Choose a watch radio'),
AppIntroItem(
icon: Icons.whatshot, title: 'Get alerts of fires in that area'),
AppIntroItem(
icon: Icons.notifications_active, title: 'Alert when there is a fire'),
];
/*
static final OnIntroFinish onFinish =
(context) => Navigator.pushNamed(context, '/?'); */
IntroPage({Key key})
: super(
items: fireItems,
onIntroFinish: (context) =>
Navigator.pushNamed(context, HomePage.routeName),
key: key);
}

4
lib/main.dart Normal file
View file

@ -0,0 +1,4 @@
import 'package:flutter/material.dart';
import 'firesApp.dart';
void main() => runApp(new FiresApp());

98
lib/mainDrawer.dart Normal file
View file

@ -0,0 +1,98 @@
import 'package:flutter/material.dart';
import 'colors.dart';
import 'sandbox.dart';
import 'introPage.dart';
import 'activeFires.dart';
class MainDrawer extends Drawer {
MainDrawer(BuildContext context, {key})
: super(key: key, child: mainDrawer(context));
}
Widget mainDrawer(BuildContext context) {
return new ListView(
// Important: Remove any padding from the ListView.
padding: EdgeInsets.zero,
children: <Widget>[
new GestureDetector(
onTap: () {
Navigator.pushNamed(context, '/');
},
child: new DrawerHeader(
child: new Column(
children: <Widget>[
new Image.asset(
'images/logo-200.png',
fit: BoxFit.scaleDown,
height: 80.0,
),
const SizedBox(height: 20.0),
new Text('seedees',
style: new TextStyle(
fontSize: 24.0,
color: Colors.white,
)),
],
),
decoration: new BoxDecoration(
color: fires300,
),
),
),
new ListTile(
// https://docs.flutter.io/flutter/material/CircleAvatar-class.html
leading: new CircleAvatar(
backgroundColor: Colors.brown.shade800,
child: new Text('VR'),
),
title: new Text('Your profile'),
onTap: () {
// Update the state of the app
// ...
// Then close the drawer
// Navigator.pop(context);
Navigator.pushNamed(context, IntroPage.routeName);
},
),
new Divider(),
new ListTile(
leading: const Icon(Icons.whatshot),
title: new Text('Active fires'),
onTap: () {
Navigator.pushNamed(context, ActiveFiresMap.routeName);
},
),
new ListTile(
leading: const Icon(Icons.location_on),
title: new Text('My areas'),
onTap: () {
// Then close the drawer
Navigator.pushNamed(context, '/subscriptions');
},
),
new Divider(),
new ListTile(
leading: const Icon(Icons.bug_report),
title: new Text('Sandbox'),
onTap: () {
Navigator.pushNamed(context, Sandbox.routeName);
},
),
new ListTile(
// https://material.io/tools/icons/?style=baseline
leading: const Icon(Icons.settings),
title: new Text('Settings'),
onTap: () {
// Update the state of the app
// ...
// Then close the drawer
Navigator.pop(context);
},
),
new AboutListTile(
// FIXME
)
],
);
}

24
lib/sandbox.dart Normal file
View file

@ -0,0 +1,24 @@
import 'package:flutter/material.dart';
import 'package:comunes_flutter/comunes_flutter.dart';
/*
Useful for debug
import 'package:fluttery/framing.dart';
new RandomColorBlock( child:
*/
class Sandbox extends StatelessWidget {
static const String routeName = '/sandbox';
@override
Widget build(BuildContext context) {
return Scaffold(
body: new CenteredColumn(
children: <Widget>[
new IconButton(
icon: new Icon(Icons.favorite), onPressed: () => {}), // l
],
),
);
}
}

22
lib/theme.dart Normal file
View file

@ -0,0 +1,22 @@
import 'package:flutter/material.dart';
import 'colors.dart';
final ThemeData firesTheme = _buildFiresTheme();
ThemeData _buildFiresTheme() {
final ThemeData base = ThemeData.light(); // light or dark
return base.copyWith(
accentColor: fires900,
primaryColor: fires600,
buttonColor: fires900,
scaffoldBackgroundColor: firesSurfaceWhite,
cardColor: firesBackgroundWhite,
textSelectionColor: fires300,
errorColor: firesErrorRed,
//TODO: Add the text themes (103)
//TODO: Add the icon themes (103)
//TODO: Decorate the inputs (103)
);
}