From 54772342e79a819d407ecdf57c2ffae0cfd240c6 Mon Sep 17 00:00:00 2001 From: Roran Date: Mon, 2 Mar 2020 20:26:25 +0100 Subject: [PATCH 1/5] added layout first screen --- lib/Pages/Umfragen/umfrage.dart | 47 +++++++ lib/Pages/Umfragen/umfragen.dart | 170 +++++++++++++++++++++++ lib/Widgets/standart/buttons.dart | 16 +++ lib/Widgets/standart/moreaTextStyle.dart | 3 + lib/morealayout.dart | 11 ++ 5 files changed, 247 insertions(+) create mode 100644 lib/Pages/Umfragen/umfrage.dart create mode 100644 lib/Pages/Umfragen/umfragen.dart diff --git a/lib/Pages/Umfragen/umfrage.dart b/lib/Pages/Umfragen/umfrage.dart new file mode 100644 index 0000000..ddef88d --- /dev/null +++ b/lib/Pages/Umfragen/umfrage.dart @@ -0,0 +1,47 @@ +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 { + @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( + elevation: 10, + pinned: true, + floating: false, + expandedHeight: 200, + backgroundColor: MoreaColors.orange, + flexibleSpace: FlexibleSpaceBar( + centerTitle: true, + title: Text('Test', style: MoreaTextStyle.title,), + ), + ), + SliverFillRemaining( + child: Column( + + ), + ) + ], + ), + ), + ); + } +} diff --git a/lib/Pages/Umfragen/umfragen.dart b/lib/Pages/Umfragen/umfragen.dart new file mode 100644 index 0000000..92cc4bc --- /dev/null +++ b/lib/Pages/Umfragen/umfragen.dart @@ -0,0 +1,170 @@ +import 'package:flutter/material.dart'; +import 'package:morea/Pages/Umfragen/umfrage.dart'; +import 'package:morea/Widgets/standart/buttons.dart'; +import 'package:morea/Widgets/standart/moreaTextStyle.dart'; +import 'package:morea/morealayout.dart'; + +class Umfragen extends StatefulWidget { + @override + _UmfragenState createState() => _UmfragenState(); +} + +class _UmfragenState extends State { + + FixedExtentScrollController fixedExtentScrollController = FixedExtentScrollController(); + + @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: FloatingActionButton( + child: Icon( + Icons.add, + color: Colors.white, + ), + backgroundColor: MoreaColors.violett, + shape: CircleBorder(side: BorderSide(color: Colors.white)), + onPressed: null, + ), + 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/Widgets/standart/buttons.dart b/lib/Widgets/standart/buttons.dart index ce78bc3..14459ee 100644 --- a/lib/Widgets/standart/buttons.dart +++ b/lib/Widgets/standart/buttons.dart @@ -72,6 +72,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, diff --git a/lib/Widgets/standart/moreaTextStyle.dart b/lib/Widgets/standart/moreaTextStyle.dart index a54e696..0beccb7 100644 --- a/lib/Widgets/standart/moreaTextStyle.dart +++ b/lib/Widgets/standart/moreaTextStyle.dart @@ -55,6 +55,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/morealayout.dart b/lib/morealayout.dart index 4a10f34..4037fb4 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'; @@ -353,6 +354,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"), From 3957e77e51f5861c631d8fbe715866259a592c0a Mon Sep 17 00:00:00 2001 From: Roran Date: Tue, 3 Mar 2020 19:02:03 +0100 Subject: [PATCH 2/5] layout overview and singleview done --- assets/animated_icon/plus_cancel.flr | Bin 0 -> 752 bytes lib/Pages/Umfragen/umfrage.dart | 248 +++++++++++++++++++++-- lib/Pages/Umfragen/umfragen.dart | 106 ++++++++-- lib/Widgets/standart/moreaTextStyle.dart | 12 ++ lib/morealayout.dart | 6 + pubspec.lock | 21 ++ pubspec.yaml | 3 + 7 files changed, 363 insertions(+), 33 deletions(-) create mode 100644 assets/animated_icon/plus_cancel.flr diff --git a/assets/animated_icon/plus_cancel.flr b/assets/animated_icon/plus_cancel.flr new file mode 100644 index 0000000000000000000000000000000000000000..bf25af716439894636c46ca1855760cdae3e8787 GIT binary patch literal 752 zcmaJ-yG{a85Iq+mP+A!ZO(?7=C~Z`B0ktyGC>C}svPvS!k_G!M{0Td1{R3>=qs#KOx*d<=1k4Fy^hUBRO?9jy$Z|#FR8zuVXFc^o1Nl4b&A561B^tR^cooE!r z{3yLu~+%nB$UGRTB}aC3j~@?39{SfrP> k73ZU7em=MSE42?V9VPtoJ_+0%chP@(nUd;dm^4KH3#$lq%K!iX literal 0 HcmV?d00001 diff --git a/lib/Pages/Umfragen/umfrage.dart b/lib/Pages/Umfragen/umfrage.dart index ddef88d..e9ccc3c 100644 --- a/lib/Pages/Umfragen/umfrage.dart +++ b/lib/Pages/Umfragen/umfrage.dart @@ -1,3 +1,5 @@ +import 'dart:ui'; + import 'package:flutter/material.dart'; import 'package:morea/Widgets/standart/moreaTextStyle.dart'; import 'package:morea/morealayout.dart'; @@ -8,15 +10,14 @@ class Umfrage extends StatefulWidget { } 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) - ), + shape: CircleBorder(side: BorderSide(color: Colors.white)), child: Icon(Icons.person_add), onPressed: null, ), @@ -24,19 +25,169 @@ class _UmfrageState extends State { child: CustomScrollView( slivers: [ SliverAppBar( + title: SABT(child: Text('Test')), elevation: 10, + forceElevated: false, + primary: true, pinned: true, floating: false, - expandedHeight: 200, + expandedHeight: 70, backgroundColor: MoreaColors.orange, - flexibleSpace: FlexibleSpaceBar( - centerTitle: true, - title: Text('Test', style: MoreaTextStyle.title,), - ), ), - SliverFillRemaining( - child: Column( - + 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(), + ], + ), + ) + ], ), ) ], @@ -44,4 +195,77 @@ class _UmfrageState extends State { ), ); } + + 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 index 92cc4bc..d0ad1da 100644 --- a/lib/Pages/Umfragen/umfragen.dart +++ b/lib/Pages/Umfragen/umfragen.dart @@ -1,17 +1,20 @@ +import 'package:flare_flutter/flare_actor.dart'; import 'package:flutter/material.dart'; import 'package:morea/Pages/Umfragen/umfrage.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'; class Umfragen extends StatefulWidget { @override _UmfragenState createState() => _UmfragenState(); } -class _UmfragenState extends State { +enum FlareState { open, close, wait } - FixedExtentScrollController fixedExtentScrollController = FixedExtentScrollController(); +class _UmfragenState extends State { + FlareState flareState = FlareState.wait; @override Widget build(BuildContext context) { @@ -25,14 +28,53 @@ class _UmfragenState extends State { labelPadding: EdgeInsets.only(bottom: 10), tabs: [Text('Alle Umfragen'), Text('Meine Umfragen')], )), - floatingActionButton: FloatingActionButton( - child: Icon( - Icons.add, - color: Colors.white, - ), + floatingActionButton: SpeedDial( backgroundColor: MoreaColors.violett, shape: CircleBorder(side: BorderSide(color: Colors.white)), - onPressed: null, + onOpen: () => setState(() { + flareState = FlareState.open; + }), + onClose: () => setState(() { + flareState = FlareState.close; + }), + child: AspectRatio( + aspectRatio: 1, + 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.format_list_bulleted, + color: Colors.white, + ), + backgroundColor: MoreaColors.violett, + shape: CircleBorder(side: BorderSide(color: Colors.white)), + label: 'Single choice'), + SpeedDialChild( + child: Icon( + Icons.event_note, + color: Colors.white, + ), + backgroundColor: MoreaColors.violett, + shape: CircleBorder(side: BorderSide(color: Colors.white)), + label: 'Multiple choice'), + SpeedDialChild( + child: Icon( + Icons.lock, + color: Colors.white, + ), + backgroundColor: MoreaColors.violett, + shape: CircleBorder(side: BorderSide(color: Colors.white)), + label: 'Multiple choice mit Limit' + ) + ], ), body: TabBarView( children: [ @@ -69,11 +111,7 @@ class _UmfragenState extends State { GestureDetector _buildCard() { return GestureDetector( onTap: () => Navigator.of(context).push( - MaterialPageRoute( - builder: (BuildContext context) => - Umfrage() - ) - ), + MaterialPageRoute(builder: (BuildContext context) => Umfrage())), child: Card( color: Colors.white, child: Padding( @@ -88,7 +126,10 @@ class _UmfragenState extends State { flex: 2, child: CircleAvatar( backgroundColor: MoreaColors.violett, - child: Text('R', style: MoreaTextStyle.raisedButton,), + child: Text( + 'R', + style: MoreaTextStyle.raisedButton, + ), ), ), Expanded( @@ -105,13 +146,23 @@ class _UmfragenState extends State { crossAxisAlignment: CrossAxisAlignment.baseline, textBaseline: TextBaseline.alphabetic, children: [ - Text('Titel', style: MoreaTextStyle.lable,), - Padding(padding: EdgeInsets.only(left: 10),), + 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: EdgeInsets.only(top: 10), + ), + Text( + 'Erstellt am: 22.02.20', + style: MoreaTextStyle.subtitle, + ) ], ), ), @@ -153,8 +204,22 @@ class _UmfragenState extends State { 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,)) + moreaSmallFlatIconButton( + '10/15', + () => print('test'), + Icon( + Icons.group, + size: 15, + color: MoreaColors.violett, + )), + moreaSmallFlatIconButton( + 'Kommentare', + null, + Icon( + Icons.comment, + size: 15, + color: MoreaColors.violett, + )) ], ), ) @@ -166,5 +231,4 @@ class _UmfragenState extends State { ), ); } - } diff --git a/lib/Widgets/standart/moreaTextStyle.dart b/lib/Widgets/standart/moreaTextStyle.dart index 0beccb7..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, diff --git a/lib/morealayout.dart b/lib/morealayout.dart index 4037fb4..b40782f 100644 --- a/lib/morealayout.dart +++ b/lib/morealayout.dart @@ -109,6 +109,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, diff --git a/pubspec.lock b/pubspec.lock index 4ac5e96..00ac2f3 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: @@ -195,6 +209,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 diff --git a/pubspec.yaml b/pubspec.yaml index 57dbf67..1d2c40c 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -35,6 +35,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 +94,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. From debc05daca1302bfed12ee25ef1c4fa92390abab Mon Sep 17 00:00:00 2001 From: Roran Date: Wed, 4 Mar 2020 18:46:46 +0100 Subject: [PATCH 3/5] 2nd commit --- lib/Pages/Teleblitz/home_page.dart | 1 - lib/Pages/Umfragen/edit_options.dart | 116 +++++++++++++++++++++ lib/Pages/Umfragen/umfragen.dart | 28 ++--- lib/Pages/Umfragen/wahl_treffen.dart | 141 ++++++++++++++++++++++++++ lib/Widgets/standart/buttons.dart | 24 +++++ lib/Widgets/standart/form_fields.dart | 35 +++++++ lib/main.dart | 33 +++++- lib/morealayout.dart | 2 + 8 files changed, 361 insertions(+), 19 deletions(-) create mode 100644 lib/Pages/Umfragen/edit_options.dart create mode 100644 lib/Pages/Umfragen/wahl_treffen.dart create mode 100644 lib/Widgets/standart/form_fields.dart 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/umfragen.dart b/lib/Pages/Umfragen/umfragen.dart index d0ad1da..47b1c73 100644 --- a/lib/Pages/Umfragen/umfragen.dart +++ b/lib/Pages/Umfragen/umfragen.dart @@ -1,6 +1,7 @@ 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'; @@ -37,8 +38,9 @@ class _UmfragenState extends State { onClose: () => setState(() { flareState = FlareState.close; }), - child: AspectRatio( - aspectRatio: 1, + child: SizedBox( + width: 35, + height: 35, child: FlareActor( 'assets/animated_icon/plus_cancel.flr', alignment: Alignment.center, @@ -49,14 +51,6 @@ class _UmfragenState extends State { ), ), children: [ - SpeedDialChild( - child: Icon( - Icons.format_list_bulleted, - color: Colors.white, - ), - backgroundColor: MoreaColors.violett, - shape: CircleBorder(side: BorderSide(color: Colors.white)), - label: 'Single choice'), SpeedDialChild( child: Icon( Icons.event_note, @@ -64,16 +58,22 @@ class _UmfragenState extends State { ), backgroundColor: MoreaColors.violett, shape: CircleBorder(side: BorderSide(color: Colors.white)), - label: 'Multiple choice'), + onTap: null, + label: 'Termin finden'), SpeedDialChild( child: Icon( - Icons.lock, + Icons.format_list_bulleted, color: Colors.white, ), backgroundColor: MoreaColors.violett, shape: CircleBorder(side: BorderSide(color: Colors.white)), - label: 'Multiple choice mit Limit' - ) + onTap: () => Navigator.of(context).push( + MaterialPageRoute( + builder: (BuildContext context) => + WahlTreffen() + ) + ), + label: 'Eine Wahl treffen'), ], ), body: TabBarView( diff --git a/lib/Pages/Umfragen/wahl_treffen.dart b/lib/Pages/Umfragen/wahl_treffen.dart new file mode 100644 index 0000000..c5c76fd --- /dev/null +++ b/lib/Pages/Umfragen/wahl_treffen.dart @@ -0,0 +1,141 @@ +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'; + +class WahlTreffen extends StatefulWidget { + @override + _WahlTreffenState createState() => _WahlTreffenState(); +} + +class _WahlTreffenState extends State { + final GlobalKey _form = GlobalKey(); + final TextEditingController _titleController = TextEditingController(); + 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); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + leading: IconButton( + icon: Icon(Icons.close), + onPressed: () => Navigator.of(context).pop(), + ), + title: Text('Neue Umfrage'), + ), + 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), + ), + ], + ), + ), + ), + ), + ), + ), + ); + } + + void _saveOptions(List> options) { + this.options = options; + } +} diff --git a/lib/Widgets/standart/buttons.dart b/lib/Widgets/standart/buttons.dart index 14459ee..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, @@ -105,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/main.dart b/lib/main.dart index 3eee0bc..96db8ed 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -7,23 +7,49 @@ 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'; + 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: '/', @@ -42,4 +68,3 @@ class MyApp extends StatelessWidget { ); } } - diff --git a/lib/morealayout.dart b/lib/morealayout.dart index b40782f..c50e935 100644 --- a/lib/morealayout.dart +++ b/lib/morealayout.dart @@ -11,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; From 4682191ed8d58dd99b460ff4ad681cc69c9fbd57 Mon Sep 17 00:00:00 2001 From: Roran Date: Mon, 9 Mar 2020 12:50:44 +0100 Subject: [PATCH 4/5] wahl treffen layout fertig --- lib/Pages/Umfragen/wahl_treffen.dart | 82 +++++++++++++++++++++++++++- lib/classes/umfrage_settings.dart | 7 +++ 2 files changed, 87 insertions(+), 2 deletions(-) create mode 100644 lib/classes/umfrage_settings.dart diff --git a/lib/Pages/Umfragen/wahl_treffen.dart b/lib/Pages/Umfragen/wahl_treffen.dart index c5c76fd..e80c25d 100644 --- a/lib/Pages/Umfragen/wahl_treffen.dart +++ b/lib/Pages/Umfragen/wahl_treffen.dart @@ -4,6 +4,7 @@ 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 @@ -13,6 +14,9 @@ class WahlTreffen extends StatefulWidget { 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 @@ -41,6 +45,8 @@ class _WahlTreffenState extends State { } ]); print(options); + umfrageSettings.hidden = false; + umfrageSettings.maybe = true; } @override @@ -53,6 +59,7 @@ class _WahlTreffenState extends State { ), title: Text('Neue Umfrage'), ), + floatingActionButton: moreaFloatingActionbutton(route: null, icon: Icon(Icons.check)), body: Form( key: _form, child: MoreaBackgroundContainer( @@ -117,14 +124,85 @@ class _WahlTreffenState extends State { return Padding( padding: const EdgeInsets.only(right: 10.0), child: Chip( - label: - Text(options[index]['controller'].text), + 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; + }); + }, + ) ], ), ), 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; +} From e5d3b1b91c5e3ccefe419aea6cadef2d4948c0a2 Mon Sep 17 00:00:00 2001 From: Roran Date: Mon, 9 Mar 2020 13:46:59 +0100 Subject: [PATCH 5/5] adding terminfinden --- lib/Pages/Teleblitz/change_teleblitz.dart | 1 + lib/Pages/Umfragen/edit_termine.dart | 13 ++ lib/Pages/Umfragen/termin_finden.dart | 223 ++++++++++++++++++++++ lib/Pages/Umfragen/umfragen.dart | 9 +- lib/main.dart | 9 + pubspec.lock | 7 +- pubspec.yaml | 2 + 7 files changed, 262 insertions(+), 2 deletions(-) create mode 100644 lib/Pages/Umfragen/edit_termine.dart create mode 100644 lib/Pages/Umfragen/termin_finden.dart 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/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/umfragen.dart b/lib/Pages/Umfragen/umfragen.dart index 47b1c73..6cef4d7 100644 --- a/lib/Pages/Umfragen/umfragen.dart +++ b/lib/Pages/Umfragen/umfragen.dart @@ -6,6 +6,7 @@ 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 @@ -58,7 +59,13 @@ class _UmfragenState extends State { ), backgroundColor: MoreaColors.violett, shape: CircleBorder(side: BorderSide(color: Colors.white)), - onTap: null, + onTap: () => Navigator.of(context).push( + MaterialPageRoute( + builder: (BuildContext context){ + return TerminFinden(); + } + ) + ), label: 'Termin finden'), SpeedDialChild( child: Icon( diff --git a/lib/main.dart b/lib/main.dart index 96db8ed..cc20160 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -8,6 +8,7 @@ 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(); @@ -65,6 +66,14 @@ class MyApp extends StatelessWidget { firestore: firestore, )), }, + localizationsDelegates: [ + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + GlobalCupertinoLocalizations.delegate + ], + supportedLocales: [ + const Locale('de', 'CH'), + ], ); } } diff --git a/pubspec.lock b/pubspec.lock index 00ac2f3..889de32 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -202,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: @@ -260,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 1d2c40c..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