File tree Expand file tree Collapse file tree 3 files changed +113
-0
lines changed Expand file tree Collapse file tree 3 files changed +113
-0
lines changed Original file line number Diff line number Diff line change 1+ import 'package:flutter/material.dart' ;
2+
3+ import 'copyable_text.dart' ;
4+
5+ class DisplayField extends StatelessWidget {
6+ final String ? label;
7+ final TextStyle labelStyle;
8+ final String ? text;
9+ final double width;
10+ final bool copyable;
11+
12+ const DisplayField ({
13+ super .key,
14+ this .label,
15+ this .labelStyle = const TextStyle (fontSize: 16 ),
16+ this .text,
17+ this .width = 360 ,
18+ this .copyable = false ,
19+ });
20+
21+ @override
22+ Widget build (BuildContext context) {
23+ // Only build the right-hand side if text is non-null
24+ final Widget ? styledField = text != null
25+ ? SizedBox (
26+ width: width,
27+ child: copyable
28+ ? CopyableText (
29+ text! ,
30+ style: const TextStyle (fontSize: 16 ),
31+ )
32+ : Text (
33+ text! ,
34+ style: const TextStyle (fontSize: 16 ),
35+ ),
36+ )
37+ : null ;
38+
39+ return Row (
40+ children: [
41+ if (label != null )
42+ Expanded (
43+ child: Text (
44+ label! ,
45+ style: labelStyle,
46+ ),
47+ ),
48+ if (styledField != null ) styledField,
49+ ],
50+ );
51+ }
52+ }
Original file line number Diff line number Diff line change 1+ import 'package:flutter/material.dart' ;
2+ import 'package:flutter_riverpod/flutter_riverpod.dart' ;
3+
4+ import '../display_field.dart' ;
5+ import '../providers.dart' ;
6+ import '../ffi.dart' ;
7+
8+ class AboutSection extends ConsumerWidget {
9+ const AboutSection ({super .key});
10+
11+ @override
12+ Widget build (BuildContext context, WidgetRef ref) {
13+ final daemonVersion = ref.watch (daemonVersionProvider);
14+ return Column (
15+ crossAxisAlignment: CrossAxisAlignment .start,
16+ children: [
17+ const Text (
18+ 'About' ,
19+ style: TextStyle (fontSize: 16 , fontWeight: FontWeight .bold),
20+ ),
21+ const SizedBox (height: 20 ),
22+ DisplayField (
23+ label: 'multipass version:' ,
24+ labelStyle: TextStyle (
25+ fontFamily: 'monospace' ,
26+ fontSize: 16 ,
27+ color: Colors .black87,
28+ ),
29+ width: 260 ,
30+ text: multipassVersion,
31+ copyable: true ,
32+ ),
33+ const SizedBox (height: 20 ),
34+ DisplayField (
35+ label: 'multipassd version:' ,
36+ labelStyle: TextStyle (
37+ fontFamily: 'monospace' ,
38+ fontSize: 16 ,
39+ color: Colors .black87,
40+ ),
41+ width: 260 ,
42+ text: daemonVersion,
43+ copyable: true ,
44+ ),
45+ const SizedBox (height: 20 ),
46+ DisplayField (
47+ label: 'Copyright (C) Canonical, Ltd.' ,
48+ labelStyle: TextStyle (
49+ fontSize: 16 ,
50+ color: Colors .grey,
51+ ),
52+ width: 260 ,
53+ copyable: false ,
54+ ),
55+ ],
56+ );
57+ }
58+ }
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
33import 'general_settings.dart' ;
44import 'usage_settings.dart' ;
55import 'virtualization_settings.dart' ;
6+ import 'about_section.dart' ;
67
78class SettingsScreen extends StatelessWidget {
89 static const sidebarKey = 'settings' ;
@@ -22,6 +23,8 @@ class SettingsScreen extends StatelessWidget {
2223 UsageSettings (),
2324 Divider (height: 60 ),
2425 VirtualizationSettings (),
26+ Divider (height: 60 ),
27+ AboutSection (),
2528 ],
2629 ),
2730 );
You can’t perform that action at this time.
0 commit comments