user_information_view.dart
1.77 KB
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
import 'package:doublefeel_flutter/data/local/user_preferences_storage.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
class UserInformationView extends StatelessWidget {
const UserInformationView({super.key});
@override
Widget build(BuildContext context) {
final userPreferencesStorage = Get.find<UserPreferencesStorage>();
return Scaffold(
appBar: AppBar(title: const Text('User Information')),
body: Obx(() {
final preferences = userPreferencesStorage.preferences.value;
final userInfo = preferences.meUserInfo;
return ListView(
padding: const EdgeInsets.all(16),
children: [
_InfoRow(label: 'userid', value: '${userInfo?.id ?? ''}'),
const Divider(height: 1, color: Color(0x66CCCCCC)),
_InfoRow(label: 'nickname', value: userInfo?.nickname ?? ''),
const Divider(height: 1, color: Color(0x66CCCCCC)),
_InfoRow(label: 'access token', value: preferences.accessToken),
],
);
}),
);
}
}
class _InfoRow extends StatelessWidget {
const _InfoRow({required this.label, required this.value});
final String label;
final String value;
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.symmetric(vertical: 14),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
label,
style: Theme.of(context).textTheme.bodySmall?.copyWith(
color: Colors.grey,
),
),
const SizedBox(height: 6),
SelectableText(
value,
style: Theme.of(context).textTheme.bodyMedium,
),
],
),
);
}
}