diff --git a/assets/animated_icon/plus_cancel.flr b/assets/animated_icon/plus_cancel.flr new file mode 100644 index 0000000..bf25af7 Binary files /dev/null and b/assets/animated_icon/plus_cancel.flr differ diff --git a/lib/Pages/Teleblitz/change_teleblitz.dart b/lib/Pages/Teleblitz/change_teleblitz.dart index 927c1fa..7c65517 100644 --- a/lib/Pages/Teleblitz/change_teleblitz.dart +++ b/lib/Pages/Teleblitz/change_teleblitz.dart @@ -500,6 +500,7 @@ class _ChangeTeleblitzState extends State context: context, initialDate: now, firstDate: now, + locale: Locale('de'), lastDate: now.add(Duration(days: 9999))); if (picked != null) { setState(() { diff --git a/lib/Pages/Teleblitz/home_page.dart b/lib/Pages/Teleblitz/home_page.dart index 65485bf..74ef771 100644 --- a/lib/Pages/Teleblitz/home_page.dart +++ b/lib/Pages/Teleblitz/home_page.dart @@ -162,7 +162,6 @@ class HomePageState extends State with TickerProviderStateMixin { key: _scaffoldKey, appBar: new AppBar( elevation: 0, - backgroundColor: MoreaColors.orange, title: new Text('Teleblitz'), bottom: TabBar( tabs: getTabList(((moreafire.getGroupID == null) diff --git a/lib/Pages/Umfragen/edit_options.dart b/lib/Pages/Umfragen/edit_options.dart new file mode 100644 index 0000000..fde747c --- /dev/null +++ b/lib/Pages/Umfragen/edit_options.dart @@ -0,0 +1,116 @@ +import 'package:flutter/material.dart'; +import 'package:morea/Widgets/standart/buttons.dart'; + +import '../../morealayout.dart'; + +class EditOptions extends StatefulWidget { + EditOptions(this.options, this.returnOptions); + + final List> options; + final Function returnOptions; + + @override + _EditOptionsState createState() => _EditOptionsState(); +} + +class _EditOptionsState extends State { + List> options; + + @override + void initState() { + super.initState(); + this.options = widget.options; + } + + @override + void dispose() { + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('Optionen'), + leading: IconButton( + icon: Icon(Icons.clear), + onPressed: () => Navigator.of(context).pop(), + ), + actions: [ + IconButton( + icon: Icon(Icons.check), + onPressed: (){ + widget.returnOptions(this.options); + Navigator.of(context).pop(); + }, + ) + ], + ), + floatingActionButton: moreaFloatingActionbutton( + route: () => setState((){ + options.add({'limit':0, 'controller': TextEditingController()}); + }), + icon: Icon(Icons.add), + ), + body: MoreaBackgroundContainer( + child: ReorderableListView( + onReorder: (oldIndex, newIndex) { + setState(() { + var reordered = options[oldIndex]; + options.insert(newIndex, reordered); + if (oldIndex > newIndex) { + options.removeAt(oldIndex + 1); + } else { + options.removeAt(oldIndex); + } + }); + }, + children: _buildOptions(), + ), + ), + ); + } + + List _buildOptions() { + print(options); + List result = []; + for (var item in options) { + result.add(Container( + key: ValueKey(item), + margin: const EdgeInsets.only(top: 10.0), + child: Card( + child: ListTile( + contentPadding: EdgeInsets.all(10), + title: TextFormField( + controller: item['controller'], + ), + subtitle: TextFormField( + initialValue: item['limit'].toString(), + decoration: InputDecoration( + labelText: 'Limit', + focusColor: MoreaColors.violett, + focusedBorder: UnderlineInputBorder( + borderSide: BorderSide(color: MoreaColors.violett))), + onEditingComplete: () { + setState(() {}); + }, + onChanged: (newVal) { + item['limit'] = int.parse(newVal); + }, + onSaved: (newVal) { + setState(() { + item['limit'] = int.parse(newVal); + }); + }, + ), + trailing: Icon( + Icons.drag_handle, + color: Colors.black, + ), + ), + ), + )); + } + return result; + } +} diff --git a/lib/Pages/Umfragen/edit_termine.dart b/lib/Pages/Umfragen/edit_termine.dart new file mode 100644 index 0000000..4243094 --- /dev/null +++ b/lib/Pages/Umfragen/edit_termine.dart @@ -0,0 +1,13 @@ +import 'package:flutter/material.dart'; + +class EditTermine extends StatefulWidget { + @override + _EditTermineState createState() => _EditTermineState(); +} + +class _EditTermineState extends State { + @override + Widget build(BuildContext context) { + return Container(); + } +} diff --git a/lib/Pages/Umfragen/termin_finden.dart b/lib/Pages/Umfragen/termin_finden.dart new file mode 100644 index 0000000..1b98703 --- /dev/null +++ b/lib/Pages/Umfragen/termin_finden.dart @@ -0,0 +1,223 @@ +import 'package:flutter/material.dart'; +import 'package:morea/Widgets/standart/buttons.dart'; +import 'package:morea/Widgets/standart/form_fields.dart'; +import 'package:morea/Widgets/standart/moreaTextStyle.dart'; +import 'package:morea/morealayout.dart'; +import 'package:morea/classes/umfrage_settings.dart'; + +class TerminFinden extends StatefulWidget { + @override + _TerminFindenState createState() => _TerminFindenState(); +} + +class _TerminFindenState extends State { + final GlobalKey _form = GlobalKey(); + final TextEditingController _titleController = TextEditingController(); + final TextEditingController _ortController = TextEditingController(); + final TextEditingController _notizController = TextEditingController(); + final UmfrageSettings umfrageSettings = UmfrageSettings(); + List> options = []; + + @override + void initState() { + super.initState(); + options.addAll([ + { + 'limit': 1, + 'controller': + TextEditingController.fromValue(TextEditingValue(text: 'test1')) + }, + { + 'limit': 1, + 'controller': + TextEditingController.fromValue(TextEditingValue(text: 'test2')) + }, + { + 'limit': 1, + 'controller': + TextEditingController.fromValue(TextEditingValue(text: 'test3')) + }, + { + 'limit': 1, + 'controller': + TextEditingController.fromValue(TextEditingValue(text: 'test4')) + } + ]); + print(options); + umfrageSettings.hidden = false; + umfrageSettings.maybe = true; + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + leading: IconButton( + icon: Icon(Icons.close), + onPressed: () => Navigator.of(context).pop(), + ), + title: Text('Neue Umfrage'), + ), + floatingActionButton: + moreaFloatingActionbutton(route: null, icon: Icon(Icons.check)), + body: Form( + key: _form, + child: MoreaBackgroundContainer( + child: SingleChildScrollView( + child: MoreaShadowContainer( + child: Padding( + padding: const EdgeInsets.all(20.0), + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.only(top: 10), + child: Text('Titel', style: MoreaTextStyle.caption), + ), + Padding( + padding: const EdgeInsets.only(top: 10.0), + child: MoreaSingleLineTextField( + keyboardType: TextInputType.text, + controller: _titleController, + validator: (value) { + if (value.isEmpty) { + return 'Bitte nicht leer lassen'; + } else { + return null; + } + }, + ), + ), + Padding( + padding: EdgeInsets.only(top: 20), + child: Row( + children: [ + Text( + 'Optionen', + style: MoreaTextStyle.caption, + ), + Padding( + padding: const EdgeInsets.only(left: 5.0), + child: moreaSmallIconButton( + 'ANPASSEN', + () => selectTermine(context), + Icon( + Icons.edit, + color: MoreaColors.violett, + size: 10, + )), + ) + ], + ), + ), + Container( + constraints: BoxConstraints(maxHeight: 50), + padding: EdgeInsets.only(top: 10), + child: ListView.builder( + physics: AlwaysScrollableScrollPhysics(), + shrinkWrap: true, + itemBuilder: (context, index) { + return Padding( + padding: const EdgeInsets.only(right: 10.0), + child: Chip( + label: Text(options[index]['controller'].text), + ), + ); + }, + scrollDirection: Axis.horizontal, + itemCount: options.length), + ), + Padding( + padding: EdgeInsets.only(top: 30), + child: Text( + 'Optional', + style: MoreaTextStyle.subtitle, + ), + ), + Padding( + padding: EdgeInsets.only(top: 20), + child: Text( + 'Ort', + style: MoreaTextStyle.caption, + ), + ), + Padding( + padding: const EdgeInsets.only(top: 10.0), + child: MoreaSingleLineTextField( + keyboardType: TextInputType.text, + validator: null, + controller: _ortController, + ), + ), + Padding( + padding: EdgeInsets.only(top: 20), + child: Text( + 'Notiz', + style: MoreaTextStyle.caption, + ), + ), + Padding( + padding: const EdgeInsets.only(top: 10.0), + child: MoreaSingleLineTextField( + keyboardType: TextInputType.text, + validator: null, + controller: _notizController, + ), + ), + Padding( + padding: EdgeInsets.only(top: 30), + child: Text( + 'Einstellungen', + style: MoreaTextStyle.subtitle, + ), + ), + SwitchListTile( + title: Text( + '\"Vielleicht\" aktivieren', + style: MoreaTextStyle.lable, + ), + value: umfrageSettings.maybe, + onChanged: (val) { + setState(() { + umfrageSettings.maybe = val; + }); + }, + ), + SwitchListTile( + title: Text( + 'Versteckte Umfrage', + style: MoreaTextStyle.lable, + ), + subtitle: Text( + 'Teilnehmer können Namen, Abstimmungen und Kommentare der anderen nicht sehen.', + style: MoreaTextStyle.subtitle, + ), + value: umfrageSettings.hidden, + onChanged: (val) { + setState(() { + umfrageSettings.hidden = val; + }); + }, + ) + ], + ), + ), + ), + ), + ), + ), + ); + } + + Future selectTermine(BuildContext context) async { + DateTime now = DateTime.now(); + await showDatePicker( + context: context, + initialDate: now, + firstDate: now, + lastDate: now.add(Duration(days: 9999)), + ); + return null; + } +} diff --git a/lib/Pages/Umfragen/umfrage.dart b/lib/Pages/Umfragen/umfrage.dart new file mode 100644 index 0000000..e9ccc3c --- /dev/null +++ b/lib/Pages/Umfragen/umfrage.dart @@ -0,0 +1,271 @@ +import 'dart:ui'; + +import 'package:flutter/material.dart'; +import 'package:morea/Widgets/standart/moreaTextStyle.dart'; +import 'package:morea/morealayout.dart'; + +class Umfrage extends StatefulWidget { + @override + _UmfrageState createState() => _UmfrageState(); +} + +class _UmfrageState extends State { + ScrollPosition flex; + + @override + Widget build(BuildContext context) { + return Scaffold( + floatingActionButton: FloatingActionButton( + backgroundColor: MoreaColors.violett, + shape: CircleBorder(side: BorderSide(color: Colors.white)), + child: Icon(Icons.person_add), + onPressed: null, + ), + body: MoreaBackgroundContainer( + child: CustomScrollView( + slivers: [ + SliverAppBar( + title: SABT(child: Text('Test')), + elevation: 10, + forceElevated: false, + primary: true, + pinned: true, + floating: false, + expandedHeight: 70, + backgroundColor: MoreaColors.orange, + ), + SliverList( + delegate: SliverChildListDelegate( + [ + Center( + child: Text( + 'Test', + style: MoreaTextStyle.title, + ), + ), + Padding( + padding: const EdgeInsets.only(top: 10.0), + child: Center( + child: Text( + 'von Test', + style: MoreaTextStyle.captionWhite, + ), + ), + ), + Padding( + padding: const EdgeInsets.only(left: 50.0, top: 20), + child: MoreaDividerWhite(), + ), + ListTile( + contentPadding: EdgeInsets.all(0), + leading: SizedBox( + width: 50, + child: Icon( + Icons.place, + color: Colors.white, + ), + ), + title: Text( + 'Ort', + style: MoreaTextStyle.lableWhite, + ), + onTap: () => print('test'), + ), + Padding( + padding: const EdgeInsets.only( + left: 50.0, + ), + child: MoreaDividerWhite(), + ), + ListTile( + contentPadding: EdgeInsets.all(0), + leading: SizedBox( + width: 50, + child: Icon( + Icons.person, + color: Colors.white, + ), + ), + title: Text( + '10 von 20', + style: MoreaTextStyle.lableWhite, + ), + onTap: () => print('test'), + ), + MoreaShadowContainer( + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.only( + topLeft: Radius.circular(10), + topRight: Radius.circular(10)), + color: Colors.black12), + padding: EdgeInsets.only( + left: 15, top: 5, bottom: 5, right: 15), + child: Text( + 'Optionen', + style: MoreaTextStyle.caption, + ), + ), + ListTile( + title: Text( + 'Datum1', + style: MoreaTextStyle.lable, + ), + trailing: Icon(Icons.check_circle_outline, + color: Colors.green), + ), + MoreaDivider(), + this._buildOption(), + MoreaDivider(), + ListTile( + title: Text( + 'Datum3', + style: MoreaTextStyle.lable, + ), + trailing: Icon(Icons.remove_circle_outline, + color: Colors.red), + ), + MoreaDivider(), + ListTile( + title: Text( + 'Datum4', + style: MoreaTextStyle.lable, + ), + trailing: + Icon(Icons.error_outline, color: Colors.orange), + ), + MoreaDivider(), + ListTile( + title: Text( + 'Datum2', + style: MoreaTextStyle.lable, + ), + trailing: + Icon(Icons.panorama_fish_eye, color: Colors.grey), + ), + MoreaDivider(), + ListTile( + title: Text( + 'Datum2', + style: MoreaTextStyle.lable, + ), + trailing: + Icon(Icons.panorama_fish_eye, color: Colors.grey), + ), + MoreaDivider(), + ListTile( + title: Text( + 'Datum2', + style: MoreaTextStyle.lable, + ), + trailing: + Icon(Icons.panorama_fish_eye, color: Colors.grey), + ), + MoreaDivider(), + ListTile( + title: Text( + 'Datum2', + style: MoreaTextStyle.lable, + ), + trailing: + Icon(Icons.panorama_fish_eye, color: Colors.grey), + ), + MoreaDivider(), + ListTile( + title: Text( + 'Datum2', + style: MoreaTextStyle.lable, + ), + trailing: + Icon(Icons.panorama_fish_eye, color: Colors.grey), + ), + MoreaDivider(), + this._buildOption(), + ], + ), + ) + ], + ), + ) + ], + ), + ), + ); + } + + ListTile _buildOption(){ + return ListTile( + title: Text( + 'Datum2', + style: MoreaTextStyle.lable, + ), + trailing: + Icon(Icons.panorama_fish_eye, color: Colors.grey), + ); + } +} + +class SABT extends StatefulWidget { + final Widget child; + + const SABT({ + Key key, + @required this.child, + }) : super(key: key); + + @override + _SABTState createState() { + return new _SABTState(); + } +} + +class _SABTState extends State { + ScrollPosition _position; + bool _visible; + + @override + void dispose() { + _removeListener(); + super.dispose(); + } + + @override + void didChangeDependencies() { + super.didChangeDependencies(); + _removeListener(); + _addListener(); + } + + void _addListener() { + _position = Scrollable.of(context)?.position; + _position?.addListener(_positionListener); + _positionListener(); + } + + void _removeListener() { + _position?.removeListener(_positionListener); + } + + void _positionListener() { + final FlexibleSpaceBarSettings settings = context + .dependOnInheritedWidgetOfExactType(aspect: FlexibleSpaceBarSettings); + bool visible = + settings == null || settings.currentExtent <= settings.minExtent; + if (_visible != visible) { + setState(() { + _visible = visible; + }); + } + } + + @override + Widget build(BuildContext context) { + return Visibility( + visible: _visible, + child: widget.child, + ); + } +} diff --git a/lib/Pages/Umfragen/umfragen.dart b/lib/Pages/Umfragen/umfragen.dart new file mode 100644 index 0000000..6cef4d7 --- /dev/null +++ b/lib/Pages/Umfragen/umfragen.dart @@ -0,0 +1,241 @@ +import 'package:flare_flutter/flare_actor.dart'; +import 'package:flutter/material.dart'; +import 'package:morea/Pages/Umfragen/umfrage.dart'; +import 'package:morea/Pages/Umfragen/wahl_treffen.dart'; +import 'package:morea/Widgets/standart/buttons.dart'; +import 'package:morea/Widgets/standart/moreaTextStyle.dart'; +import 'package:morea/morealayout.dart'; +import 'package:flutter_speed_dial/flutter_speed_dial.dart'; +import 'termin_finden.dart'; + +class Umfragen extends StatefulWidget { + @override + _UmfragenState createState() => _UmfragenState(); +} + +enum FlareState { open, close, wait } + +class _UmfragenState extends State { + FlareState flareState = FlareState.wait; + + @override + Widget build(BuildContext context) { + return DefaultTabController( + initialIndex: 0, + length: 2, + child: Scaffold( + appBar: AppBar( + title: Text('Umfragen'), + bottom: TabBar( + labelPadding: EdgeInsets.only(bottom: 10), + tabs: [Text('Alle Umfragen'), Text('Meine Umfragen')], + )), + floatingActionButton: SpeedDial( + backgroundColor: MoreaColors.violett, + shape: CircleBorder(side: BorderSide(color: Colors.white)), + onOpen: () => setState(() { + flareState = FlareState.open; + }), + onClose: () => setState(() { + flareState = FlareState.close; + }), + child: SizedBox( + width: 35, + height: 35, + child: FlareActor( + 'assets/animated_icon/plus_cancel.flr', + alignment: Alignment.center, + fit: BoxFit.contain, + animation: flareState == FlareState.open + ? 'go' + : flareState == FlareState.close ? 'back' : 'idle', + ), + ), + children: [ + SpeedDialChild( + child: Icon( + Icons.event_note, + color: Colors.white, + ), + backgroundColor: MoreaColors.violett, + shape: CircleBorder(side: BorderSide(color: Colors.white)), + onTap: () => Navigator.of(context).push( + MaterialPageRoute( + builder: (BuildContext context){ + return TerminFinden(); + } + ) + ), + label: 'Termin finden'), + SpeedDialChild( + child: Icon( + Icons.format_list_bulleted, + color: Colors.white, + ), + backgroundColor: MoreaColors.violett, + shape: CircleBorder(side: BorderSide(color: Colors.white)), + onTap: () => Navigator.of(context).push( + MaterialPageRoute( + builder: (BuildContext context) => + WahlTreffen() + ) + ), + label: 'Eine Wahl treffen'), + ], + ), + body: TabBarView( + children: [ + MoreaBackgroundContainer( + child: SingleChildScrollView( + child: Padding( + padding: EdgeInsets.all(20), + child: Column( + children: [ + _buildCard(), + Padding(padding: EdgeInsets.only(top: 10)), + _buildCard(), + Padding(padding: EdgeInsets.only(top: 10)), + ], + ), + ), + ), + ), + MoreaBackgroundContainer( + child: SingleChildScrollView( + child: Padding( + padding: EdgeInsets.all(20), + child: Column( + children: [], + ), + ), + ), + ), + ], + )), + ); + } + + GestureDetector _buildCard() { + return GestureDetector( + onTap: () => Navigator.of(context).push( + MaterialPageRoute(builder: (BuildContext context) => Umfrage())), + child: Card( + color: Colors.white, + child: Padding( + padding: const EdgeInsets.all(15.0), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Expanded( + flex: 2, + child: CircleAvatar( + backgroundColor: MoreaColors.violett, + child: Text( + 'R', + style: MoreaTextStyle.raisedButton, + ), + ), + ), + Expanded( + flex: 1, + child: Container(), + ), + Expanded( + flex: 12, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.baseline, + textBaseline: TextBaseline.alphabetic, + children: [ + Text( + 'Titel', + style: MoreaTextStyle.lable, + ), + Padding( + padding: EdgeInsets.only(left: 10), + ), + Text('Von Test', style: MoreaTextStyle.sender), + ], + ), + Padding( + padding: EdgeInsets.only(top: 10), + ), + Text( + 'Erstellt am: 22.02.20', + style: MoreaTextStyle.subtitle, + ) + ], + ), + ), + ], + ), + Padding( + padding: const EdgeInsets.only(top: 10), + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Expanded( + flex: 2, + child: Container(), + ), + Expanded( + flex: 1, + child: Container(), + ), + Expanded( + flex: 12, + child: MoreaDivider(), + ) + ], + ), + ), + Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Expanded( + flex: 2, + child: Container(), + ), + Expanded( + flex: 1, + child: Container(), + ), + Expanded( + flex: 12, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + moreaSmallFlatIconButton( + '10/15', + () => print('test'), + Icon( + Icons.group, + size: 15, + color: MoreaColors.violett, + )), + moreaSmallFlatIconButton( + 'Kommentare', + null, + Icon( + Icons.comment, + size: 15, + color: MoreaColors.violett, + )) + ], + ), + ) + ], + ) + ], + ), + ), + ), + ); + } +} diff --git a/lib/Pages/Umfragen/wahl_treffen.dart b/lib/Pages/Umfragen/wahl_treffen.dart new file mode 100644 index 0000000..e80c25d --- /dev/null +++ b/lib/Pages/Umfragen/wahl_treffen.dart @@ -0,0 +1,219 @@ +import 'package:flutter/material.dart'; +import 'package:morea/Pages/Umfragen/edit_options.dart'; +import 'package:morea/Widgets/standart/buttons.dart'; +import 'package:morea/Widgets/standart/form_fields.dart'; +import 'package:morea/Widgets/standart/moreaTextStyle.dart'; +import 'package:morea/morealayout.dart'; +import 'package:morea/classes/umfrage_settings.dart'; + +class WahlTreffen extends StatefulWidget { + @override + _WahlTreffenState createState() => _WahlTreffenState(); +} + +class _WahlTreffenState extends State { + final GlobalKey _form = GlobalKey(); + final TextEditingController _titleController = TextEditingController(); + final TextEditingController _ortController = TextEditingController(); + final TextEditingController _notizController = TextEditingController(); + final UmfrageSettings umfrageSettings = UmfrageSettings(); + List> options = []; + + @override + void initState() { + super.initState(); + options.addAll([ + { + 'limit': 1, + 'controller': + TextEditingController.fromValue(TextEditingValue(text: 'test1')) + }, + { + 'limit': 1, + 'controller': + TextEditingController.fromValue(TextEditingValue(text: 'test2')) + }, + { + 'limit': 1, + 'controller': + TextEditingController.fromValue(TextEditingValue(text: 'test3')) + }, + { + 'limit': 1, + 'controller': + TextEditingController.fromValue(TextEditingValue(text: 'test4')) + } + ]); + print(options); + umfrageSettings.hidden = false; + umfrageSettings.maybe = true; + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + leading: IconButton( + icon: Icon(Icons.close), + onPressed: () => Navigator.of(context).pop(), + ), + title: Text('Neue Umfrage'), + ), + floatingActionButton: moreaFloatingActionbutton(route: null, icon: Icon(Icons.check)), + body: Form( + key: _form, + child: MoreaBackgroundContainer( + child: SingleChildScrollView( + child: MoreaShadowContainer( + child: Padding( + padding: const EdgeInsets.all(20.0), + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.only(top: 10), + child: Text('Titel', style: MoreaTextStyle.caption), + ), + Padding( + padding: const EdgeInsets.only(top: 10.0), + child: MoreaSingleLineTextField( + keyboardType: TextInputType.text, + controller: _titleController, + validator: (value) { + if (value.isEmpty) { + return 'Bitte nicht leer lassen'; + } else { + return null; + } + }, + ), + ), + Padding( + padding: EdgeInsets.only(top: 20), + child: Row( + children: [ + Text( + 'Optionen', + style: MoreaTextStyle.caption, + ), + Padding( + padding: const EdgeInsets.only(left: 5.0), + child: moreaSmallIconButton( + 'ANPASSEN', + () => Navigator.of(context).push( + MaterialPageRoute( + builder: (context) => EditOptions( + this.options, this._saveOptions))), + Icon( + Icons.edit, + color: MoreaColors.violett, + size: 10, + )), + ) + ], + ), + ), + Container( + constraints: BoxConstraints(maxHeight: 50), + padding: EdgeInsets.only(top: 10), + child: ListView.builder( + physics: AlwaysScrollableScrollPhysics(), + shrinkWrap: true, + itemBuilder: (context, index) { + return Padding( + padding: const EdgeInsets.only(right: 10.0), + child: Chip( + label: Text(options[index]['controller'].text), + ), + ); + }, + scrollDirection: Axis.horizontal, + itemCount: options.length), + ), + Padding( + padding: EdgeInsets.only(top: 30), + child: Text( + 'Optional', + style: MoreaTextStyle.subtitle, + ), + ), + Padding( + padding: EdgeInsets.only(top: 20), + child: Text( + 'Ort', + style: MoreaTextStyle.caption, + ), + ), + Padding( + padding: const EdgeInsets.only(top: 10.0), + child: MoreaSingleLineTextField( + keyboardType: TextInputType.text, + validator: null, + controller: _ortController, + ), + ), + Padding( + padding: EdgeInsets.only(top: 20), + child: Text( + 'Notiz', + style: MoreaTextStyle.caption, + ), + ), + Padding( + padding: const EdgeInsets.only(top: 10.0), + child: MoreaSingleLineTextField( + keyboardType: TextInputType.text, + validator: null, + controller: _notizController, + ), + ), + Padding( + padding: EdgeInsets.only(top: 30), + child: Text( + 'Einstellungen', + style: MoreaTextStyle.subtitle, + ), + ), + SwitchListTile( + title: Text( + '\"Vielleicht\" aktivieren', + style: MoreaTextStyle.lable, + ), + value: umfrageSettings.maybe, + onChanged: (val) { + setState(() { + umfrageSettings.maybe = val; + }); + }, + ), + SwitchListTile( + title: Text( + 'Versteckte Umfrage', + style: MoreaTextStyle.lable, + ), + subtitle: Text( + 'Teilnehmer können Namen, Abstimmungen und Kommentare der anderen nicht sehen.', + style: MoreaTextStyle.subtitle, + ), + value: umfrageSettings.hidden, + onChanged: (val) { + setState(() { + umfrageSettings.hidden = val; + }); + }, + ) + ], + ), + ), + ), + ), + ), + ), + ); + } + + void _saveOptions(List> options) { + this.options = options; + } +} diff --git a/lib/Widgets/standart/buttons.dart b/lib/Widgets/standart/buttons.dart index ce78bc3..7031f7e 100644 --- a/lib/Widgets/standart/buttons.dart +++ b/lib/Widgets/standart/buttons.dart @@ -13,6 +13,17 @@ Widget moreaEditActionbutton({@required Function route, Key key}) { ); } +Widget moreaFloatingActionbutton({@required Function route, @required Icon icon, Key key}) { + return new FloatingActionButton( + key: key == null ? null : key, + elevation: 1.0, + child: icon, + backgroundColor: MoreaColors.violett, + onPressed: () => route(), + shape: CircleBorder(side: BorderSide(color: Colors.white)), + ); +} + Widget moreaRaisedButton(String text, Function action) { return RaisedButton( color: MoreaColors.violett, @@ -72,6 +83,22 @@ Widget moreaFlatIconButton(String text, Function action, Icon icon) { ); } +Widget moreaSmallFlatIconButton(String text, Function action, Icon icon) { + return FlatButton.icon( + onPressed: action, + icon: icon, + label: Text( + text, + style: MoreaTextStyle.smallFlatButton, + ), + color: Colors.transparent, + padding: EdgeInsets.symmetric(vertical: 5, horizontal: 10), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.all(Radius.circular(5)), + side: BorderSide(color: MoreaColors.violett,),), + ); +} + Widget moreaFlatButton(String text, Function action) { return FlatButton( onPressed: action, @@ -89,3 +116,16 @@ Widget moreaFlatButton(String text, Function action) { ); } +Widget moreaSmallIconButton(String text, Function action, Icon icon) { + return FlatButton.icon( + onPressed: action, + icon: icon, + label: Text( + text, + style: MoreaTextStyle.smallFlatButton, + ), + color: Colors.transparent, + shape: null, + ); +} + diff --git a/lib/Widgets/standart/form_fields.dart b/lib/Widgets/standart/form_fields.dart new file mode 100644 index 0000000..53e7430 --- /dev/null +++ b/lib/Widgets/standart/form_fields.dart @@ -0,0 +1,35 @@ +import 'package:flutter/material.dart'; +import 'package:morea/Widgets/standart/moreaTextStyle.dart'; +import 'package:morea/morealayout.dart'; + +class MoreaSingleLineTextField extends StatelessWidget { + MoreaSingleLineTextField({ + Key key, + @required this.controller, + @required this.validator, + @required this.keyboardType, + }); + + final TextEditingController controller; + final TextInputType keyboardType; + final FormFieldValidator validator; + + @override + Widget build(BuildContext context) { + return TextFormField( + key: key, + controller: controller, + maxLines: 1, + keyboardType: keyboardType, + style: MoreaTextStyle.textField, + cursorColor: MoreaColors.violett, + decoration: InputDecoration( + errorBorder: + OutlineInputBorder(borderSide: BorderSide(color: Colors.red)), + border: OutlineInputBorder(), + focusedBorder: OutlineInputBorder( + borderSide: BorderSide(color: MoreaColors.violett)), + ), + validator: validator); + } +} diff --git a/lib/Widgets/standart/moreaTextStyle.dart b/lib/Widgets/standart/moreaTextStyle.dart index a54e696..aedd133 100644 --- a/lib/Widgets/standart/moreaTextStyle.dart +++ b/lib/Widgets/standart/moreaTextStyle.dart @@ -25,6 +25,12 @@ class MoreaTextStyle { fontSize: 16, letterSpacing: 0.15); + static TextStyle lableWhite = TextStyle( + color: Colors.white, + fontWeight: FontWeight.w600, + fontSize: 16, + letterSpacing: 0.15); + static TextStyle normal = TextStyle( color: Colors.black, fontSize: 16, @@ -39,6 +45,12 @@ class MoreaTextStyle { color: Colors.black, letterSpacing: 0.4); + static TextStyle captionWhite = TextStyle( + fontSize: 14, + fontWeight: FontWeight.w600, + color: Colors.white, + letterSpacing: 0.4); + static TextStyle subtitle = TextStyle( fontSize: 14, fontWeight: FontWeight.w500, @@ -55,6 +67,9 @@ class MoreaTextStyle { static TextStyle flatButton = TextStyle( fontSize: 14, fontWeight: FontWeight.w700, color: MoreaColors.violett); + static TextStyle smallFlatButton = TextStyle( + fontSize: 10, fontWeight: FontWeight.w700, color: MoreaColors.violett); + static TextStyle warningButton = TextStyle( fontSize: 14, fontWeight: FontWeight.w700, color: Colors.red); diff --git a/lib/classes/umfrage_settings.dart b/lib/classes/umfrage_settings.dart new file mode 100644 index 0000000..62b9503 --- /dev/null +++ b/lib/classes/umfrage_settings.dart @@ -0,0 +1,7 @@ +class UmfrageSettings { + UmfrageSettings(); + + bool maybe; + + bool hidden; +} diff --git a/lib/main.dart b/lib/main.dart index 3eee0bc..cc20160 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -7,23 +7,50 @@ import 'package:morea/Widgets/standart/restartWidget.dart'; import 'package:morea/services/auth.dart'; import 'package:morea/services/utilities/notification.dart'; import 'morealayout.dart'; +import 'package:flutter/services.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; + Future main() async { WidgetsFlutterBinding.ensureInitialized(); + SystemChrome.setSystemUIOverlayStyle( + SystemUiOverlayStyle( + statusBarIconBrightness: Brightness.dark, + ) + ); notificationGetPermission(); - runApp(RestartWidget(child: MyApp(),)); + runApp(RestartWidget( + child: MyApp(), + )); } class MyApp extends StatelessWidget { final Firestore firestore = new Firestore(); + @override Widget build(BuildContext context) { return new MaterialApp( title: 'Pfadi Morea', debugShowCheckedModeBanner: false, theme: new ThemeData( - backgroundColor: Colors.white, + appBarTheme: AppBarTheme(color: MoreaColors.orange, brightness: Brightness.light), + primaryIconTheme: IconThemeData(color: Colors.black), + primaryTextTheme: TextTheme( + title: TextStyle(color: Colors.black), + display1: TextStyle(color: Colors.black), + display2: TextStyle(color: Colors.black), + display3: TextStyle(color: Colors.black), + display4: TextStyle(color: Colors.black), + body1: TextStyle(color: Colors.black), + body2: TextStyle(color: Colors.black), + headline: TextStyle(color: Colors.black), + subhead: TextStyle(color: Colors.black), + caption: TextStyle(color: Colors.black), + button: TextStyle(color: Colors.black), + subtitle: TextStyle(color: Colors.black), + overline: TextStyle(color: Colors.black), + ), primarySwatch: MaterialColor( - MoreaColors.appBarInt, MoreaColors.violettMaterialColor), + MoreaColors.violettInt, MoreaColors.violettMaterialColor), fontFamily: 'Raleway', ), initialRoute: '/', @@ -39,7 +66,14 @@ class MyApp extends StatelessWidget { firestore: firestore, )), }, + localizationsDelegates: [ + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + GlobalCupertinoLocalizations.delegate + ], + supportedLocales: [ + const Locale('de', 'CH'), + ], ); } } - diff --git a/lib/morealayout.dart b/lib/morealayout.dart index 4a10f34..c50e935 100644 --- a/lib/morealayout.dart +++ b/lib/morealayout.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:morea/Pages/Umfragen/umfragen.dart'; import 'package:morea/services/crud.dart'; import 'package:morea/services/morea_firestore.dart'; @@ -10,7 +11,9 @@ import 'morea_strings.dart'; class MoreaColors { static Color violett = Color(0xff7a62ff); + static Color violettDark = Color(0xff5c48bf); static Color orange = Color(0xffff9262); + static Color orangeDark = Color(0xffDC7D55); static int violettInt = 0xff7a62ff; static int orangeInt = 0xffff9262; static int appBarInt = 0xffFF9B70; @@ -108,6 +111,12 @@ class MoreaDivider extends Divider { final Color color = Colors.black26; } +class MoreaDividerWhite extends Divider { + final double thickness = 1; + final Color color = Colors.white; + final double height = 1; +} + BottomAppBar moreaChildBottomAppBar(Map navigationMap) { return BottomAppBar( color: MoreaColors.bottomAppBar, @@ -353,6 +362,16 @@ Drawer moreaDrawer( onTap: () => makeLeiterWidget(context, moreafire.getUserMap[userMapUID], moreafire.getGroupID), ), + ListTile( + title: Text('Umfragen'), + trailing: Icon(Icons.sort), + onTap: () => Navigator.of(context).push( + MaterialPageRoute( + builder: (BuildContext context) => + Umfragen() + ) + ), + ), new Divider(), new ListTile( title: new Text("Über dieses App"), diff --git a/pubspec.lock b/pubspec.lock index 4ac5e96..889de32 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -155,6 +155,20 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "6.0.9" + flare_dart: + dependency: transitive + description: + name: flare_dart + url: "https://pub.dartlang.org" + source: hosted + version: "2.3.3" + flare_flutter: + dependency: "direct main" + description: + name: flare_flutter + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.1" flip_card: dependency: "direct main" description: @@ -188,6 +202,11 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.7.4" + flutter_localizations: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" flutter_masked_text: dependency: "direct main" description: @@ -195,6 +214,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.8.0" + flutter_speed_dial: + dependency: "direct main" + description: + name: flutter_speed_dial + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.5" flutter_test: dependency: "direct dev" description: flutter @@ -239,7 +265,7 @@ packages: name: intl url: "https://pub.dartlang.org" source: hosted - version: "0.16.1" + version: "0.16.0" js: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 57dbf67..50087d9 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -15,6 +15,8 @@ environment: dependencies: flutter: sdk: flutter + flutter_localizations: + sdk: flutter firebase_auth: 0.15.0+1 firebase_messaging: any cloud_functions: ^0.4.1+4 @@ -35,6 +37,8 @@ dependencies: flip_card: ^0.4.4 showcaseview: ^0.1.5 device_info: ^0.4.1+4 + flutter_speed_dial: ^1.2.5 + flare_flutter: any shared_preferences: any @@ -92,6 +96,7 @@ flutter: - assets/images/logo.jpeg - assets/images/background.png - assets/icon/logo_loading.png + - assets/animated_icon/plus_cancel.flr # An image asset can refer to one or more resolution-specific "variants", see # https://flutter.io/assets-and-images/#resolution-aware.