Skip to content

Commit

Permalink
Added choose citizen screen
Browse files Browse the repository at this point in the history
+ Added design for choose citizen screen
  • Loading branch information
AquaHippo committed Nov 23, 2023
1 parent 2627038 commit c371682
Show file tree
Hide file tree
Showing 3 changed files with 190 additions and 5 deletions.
185 changes: 185 additions & 0 deletions lib/screens/choose_citizen_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -29,6 +30,190 @@ class _ChooseCitizenScreenState extends State<ChooseCitizenScreen> {
@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: <Widget>[
/// The blue left part of screen
Expanded(
flex: 1,
child: Container(

child: Stack(children: <Widget>[

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: <Widget>[
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: <Widget>[
Row(children: <Widget>[
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: <Widget>[
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<List<DisplayNameModel>>(
stream: _bloc.citizen,
builder: (BuildContext context,
AsyncSnapshot<List<DisplayNameModel>> 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;
Expand Down
8 changes: 4 additions & 4 deletions lib/screens/weekplan_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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<UserWeekModel>(
stream: _weekplanBloc.userWeek,
initialData: null,
builder: (BuildContext context,
child: StreamBuilder<UserWeekModel>(
stream: _weekplanBloc.userWeek,
initialData: null,
builder: (BuildContext context,
AsyncSnapshot<UserWeekModel> snapshot) {
if (snapshot.hasData) {
return _buildWeeks(snapshot.data.week, context);
Expand Down
2 changes: 1 addition & 1 deletion lib/screens/weekplan_selector_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ class _WeekplanSelectorScreenState extends State<WeekplanSelectorScreen> {
}

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),
Expand Down

0 comments on commit c371682

Please sign in to comment.