-
Notifications
You must be signed in to change notification settings - Fork 0
/
menu.dart
73 lines (67 loc) · 1.71 KB
/
menu.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
import 'session.dart';
import 'util.dart';
import 'dart:convert';
import 'dart:io';
class MenuPage extends StatelessWidget {
final Map<String, dynamic>? user;
BuildContext otherContext;
MenuPage(this.user, this.otherContext);
Widget buildBody(BuildContext context) {
return Column(
children: [
Padding(
padding: const EdgeInsets.all(16.0),
child: buildTextField(),
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
SizedBox(
width: 200,
height: 50,
child: ElevatedButton.icon(
onPressed: () {
Navigator.popUntil(otherContext, (route) => route.isFirst);
},
icon: Icon(Icons.logout),
label: Text('Logout'),
),
),
],
),
],
);
}
Widget buildTextField() {
String? labelValue = user?['name'];
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'User: ' + (labelValue ?? ''),
style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
),
SizedBox(height: 8),
],
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Colors.white,
leading: IconButton(
icon: Icon(Icons.arrow_back),
color: Colors.black,
onPressed: () {
Navigator.pop(otherContext);
},
),
title: Image.asset( 'assets/paws.jpg', width: 280, height: 100),
),
body: buildBody(context),
);
}
}