diff --git a/lib/screens/choose_citizen_screen.dart b/lib/screens/choose_citizen_screen.dart index b5ead0af3..c1798051f 100644 --- a/lib/screens/choose_citizen_screen.dart +++ b/lib/screens/choose_citizen_screen.dart @@ -15,6 +15,7 @@ import 'package:weekplanner/screens/weekplan_selector_screen.dart'; import 'package:weekplanner/style/font_size.dart'; import 'package:weekplanner/widgets/citizen_avatar_widget.dart'; import 'package:weekplanner/widgets/giraf_app_bar_widget.dart'; +import 'package:weekplanner/widgets/input_fields_weekplan.dart'; /// The screen to choose a citizen class ChooseCitizenScreen extends StatefulWidget { @@ -29,6 +30,190 @@ class _ChooseCitizenScreenState extends State { @override Widget build(BuildContext context) { final Size screenSize = MediaQuery.of(context).size; + final bool portrait = + MediaQuery.of(context).orientation == Orientation.portrait; + + /// screen background + return Scaffold( + resizeToAvoidBottomInset: false, + body: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + /// The blue left part of screen + Expanded( + flex: 1, + child: Container( + + child: Stack(children: [ + + Image.asset( + 'assets/icons/giraf_blue_long.png', + repeat: ImageRepeat.repeat, + height: screenSize.height, + fit: BoxFit.cover, + ), + Container( + padding: EdgeInsets.all(50.0), + child: Column(children: [ + Align( + alignment: Alignment.center, + child: Builder( + builder: (BuildContext context) { + return IconButton( + key: Key('NavigationMenu'), + padding: EdgeInsets.all(0.0), + color: Colors.white, + icon: Icon(Icons.menu, size: 55), + onPressed: () { + Scaffold.of(context).openDrawer(); + }, + ); + } + ), + ), + ], + ), + ), + ], + ), + ), + ), + /// The white middle of the screen + Expanded( + flex: 7, + child: Container( + width: screenSize.width, + height: screenSize.height, + padding: portrait + ? const EdgeInsets.fromLTRB(0, 0, 0, 0) + : const EdgeInsets.fromLTRB(0, 20, 0,0), + child: Stack(children: [ + Row(children: [ + Container( + padding: portrait + ? const EdgeInsets.fromLTRB(0, 0, 0, 0) + : const EdgeInsets.fromLTRB(20, 0, 0, 0), + child: Align( + alignment: Alignment.topLeft, + child: Text( + 'Vælg bruger', + textAlign: TextAlign.left, + style: TextStyle(fontWeight: FontWeight.bold, fontSize: GirafFont.headline, fontFamily: 'Quicksand-Bold'), + ), + ), + ), + Container( + child: Column(children: [ + Align( + alignment: Alignment.topRight, + child: IconButton( + key: const Key('EditUser'), + padding: portrait + ? const EdgeInsets.fromLTRB(0, 0, 0, 0) + : const EdgeInsets.fromLTRB(650, 0, 40, 0), + color: Colors.black, + icon: const Icon(Icons.create_outlined, size: 50), + onPressed: () { + ///_pushEditWeekPlan(context); //Does not work yet + }, + ), + ), + ], + ), + ), + ], + ), + Container( + padding: portrait + ? const EdgeInsets.fromLTRB(0, 0, 0, 0) + : const EdgeInsets.fromLTRB(0, 70, 0, 0), + child: StreamBuilder>( + stream: _bloc.citizen, + builder: (BuildContext context, + AsyncSnapshot> snapshot) { + if (snapshot.connectionState != ConnectionState.waiting) { + return Padding( + padding: const EdgeInsets.symmetric( + vertical: 0, + horizontal: 20, + ), + child: GridView.count( + crossAxisCount: portrait ? 2 : 4, + children: + _buildCitizenSelectionList(context, snapshot)), + ); + } else { + return Container( + child: const Text('Loading...'), + ); + } + }, + ), + ), + ], + ), + ), + ), + /// The blue right part of screen + Expanded( + flex: 1, + child: Container( + height: screenSize.height, + child: Image.asset( + 'assets/icons/giraf_blue_long.png', + repeat: ImageRepeat.repeat, + fit: BoxFit.cover, + ), + ) + ), + ] + ), + drawer: Drawer( + child: ListView( + children: [ + ListTile( + leading: const Icon(Icons.home), + title: const Text('Ugeplaner'), + onTap: () { + Navigator.pop(context); + Navigator.of(context).pop(); + }, + ), + ListTile( + leading: const Icon(Icons.person), + title: const Text('Profil'), + onTap: () { + Navigator.pop(context); + Navigator.pushNamed(context, '/profil'); + }, + ), + ListTile( + leading: const Icon(Icons.person), + title: const Text('Skift bruger'), + onTap: () { + Navigator.pop(context); + Navigator.pushNamed(context, '/skift bruger'); + }, + ), + ListTile( + leading: const Icon(Icons.exit_to_app), + title: const Text('Log af'), + onTap: () { + Navigator.pop(context); + Navigator.pushNamed(context, '/log af'); + }, + ), + ], + ), + ), + ); + } + + + + @override + Widget build2(BuildContext context) { + final Size screenSize = MediaQuery.of(context).size; //_api.user.getUserByName("Guardian-dev") final bool portrait = MediaQuery.of(context).orientation == Orientation.portrait; diff --git a/lib/screens/weekplan_screen.dart b/lib/screens/weekplan_screen.dart index 2fc12fc12..bd8d11df0 100644 --- a/lib/screens/weekplan_screen.dart +++ b/lib/screens/weekplan_screen.dart @@ -163,10 +163,10 @@ class WeekplanScreen extends StatelessWidget { padding: portrait ? const EdgeInsets.fromLTRB(0, 0, 0, 0) : const EdgeInsets.fromLTRB(0, 70, 0, 0), - child: StreamBuilder( - stream: _weekplanBloc.userWeek, - initialData: null, - builder: (BuildContext context, + child: StreamBuilder( + stream: _weekplanBloc.userWeek, + initialData: null, + builder: (BuildContext context, AsyncSnapshot snapshot) { if (snapshot.hasData) { return _buildWeeks(snapshot.data.week, context); diff --git a/lib/screens/weekplan_selector_screen.dart b/lib/screens/weekplan_selector_screen.dart index 0c3c5b5e6..a50ff95b3 100644 --- a/lib/screens/weekplan_selector_screen.dart +++ b/lib/screens/weekplan_selector_screen.dart @@ -470,7 +470,7 @@ class _WeekplanSelectorScreenState extends State { } if (isMarked) { - _pushEditWeekPlan(context); //Det virker men man kan ikke edit den + /// _pushEditWeekPlan(context); //Det virker men man siden bliver mærkelig return Container( decoration: BoxDecoration( border: Border.all(color: theme.GirafColors.black, width: 5),