Skip to content

Commit 6a92f72

Browse files
authored
fix: move tabs back to the page, add release bot (#447)
1 parent b306f52 commit 6a92f72

File tree

8 files changed

+200
-81
lines changed

8 files changed

+200
-81
lines changed

.github/workflows/release.yml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
workflow_dispatch:
8+
9+
jobs:
10+
release:
11+
permissions:
12+
contents: write
13+
pull-requests: write
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: googleapis/release-please-action@v4
17+
with:
18+
release-type: dart

lib/app.dart

+11
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import 'dart:ui';
2+
13
import 'package:flutter/material.dart';
24
import 'package:flutter_localized_locales/flutter_localized_locales.dart';
35
import 'package:provider/provider.dart';
@@ -28,6 +30,15 @@ class UbuntuSettingsApp extends StatelessWidget {
2830
supportedLocales: AppLocalizations.supportedLocales,
2931
localizationsDelegates: AppLocalizations.localizationsDelegates +
3032
[const LocaleNamesLocalizationsDelegate()],
33+
scrollBehavior: const MaterialScrollBehavior().copyWith(
34+
dragDevices: {
35+
PointerDeviceKind.mouse,
36+
PointerDeviceKind.touch,
37+
PointerDeviceKind.stylus,
38+
PointerDeviceKind.unknown,
39+
PointerDeviceKind.trackpad,
40+
},
41+
),
3142
);
3243
},
3344
),

lib/view/pages/apps/apps_page.dart

+11-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import 'dart:io';
22

33
import 'package:flutter/material.dart';
4+
import 'package:settings/constants.dart';
45
import 'package:settings/l10n/l10n.dart';
56
import 'package:settings/view/pages/settings_page.dart';
67
import 'package:yaru/yaru.dart';
@@ -22,13 +23,16 @@ class AppsPage extends StatelessWidget {
2223
Widget build(BuildContext context) {
2324
return SettingsPage(
2425
children: [
25-
YaruSection(
26-
child: YaruTile(
27-
leading: const Text('Apps can be managed in the App Store'),
28-
trailing: ElevatedButton.icon(
29-
onPressed: () => Process.start('snap-store', []),
30-
label: const Text('Open'),
31-
icon: const Icon(YaruIcons.application_bag),
26+
SizedBox(
27+
width: kDefaultWidth,
28+
child: YaruSection(
29+
child: YaruTile(
30+
leading: const Text('Apps can be managed in the App Store'),
31+
trailing: ElevatedButton.icon(
32+
onPressed: () => Process.start('snap-store', []),
33+
label: const Text('Open'),
34+
icon: const Icon(YaruIcons.application_bag),
35+
),
3236
),
3337
),
3438
),

lib/view/pages/connections/connections_page.dart

+50-27
Original file line numberDiff line numberDiff line change
@@ -33,23 +33,43 @@ class ConnectionsPage extends StatefulWidget {
3333
State<ConnectionsPage> createState() => _ConnectionsPageState();
3434
}
3535

36-
class _ConnectionsPageState extends State<ConnectionsPage> {
36+
class _ConnectionsPageState extends State<ConnectionsPage>
37+
with SingleTickerProviderStateMixin {
38+
late TabController _controller;
39+
40+
@override
41+
void initState() {
42+
super.initState();
43+
_controller = TabController(length: 3, vsync: this);
44+
}
45+
46+
@override
47+
void dispose() {
48+
_controller.dispose();
49+
super.dispose();
50+
}
51+
3752
@override
3853
Widget build(BuildContext context) {
3954
final wifiModel = context.watch<WifiModel>();
4055

41-
return DefaultTabController(
42-
length: 3,
43-
child: Scaffold(
44-
appBar: YaruWindowTitleBar(
45-
titleSpacing: 20,
46-
centerTitle: true,
47-
border: BorderSide.none,
48-
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
49-
title: const SizedBox(
56+
return Scaffold(
57+
appBar: YaruWindowTitleBar(
58+
titleSpacing: 20,
59+
centerTitle: true,
60+
border: BorderSide.none,
61+
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
62+
title: Text(context.l10n.connectionsPageTitle),
63+
),
64+
body: Column(
65+
children: [
66+
SizedBox(
5067
width: 400,
51-
child: TabBar(
52-
tabs: [
68+
child: YaruTabBar(
69+
tabController: _controller,
70+
tabs:
71+
// TODO: localize
72+
const [
5373
TitleBarTab(
5474
text: 'Wi-Fi',
5575
iconData: YaruIcons.network_wireless,
@@ -65,24 +85,27 @@ class _ConnectionsPageState extends State<ConnectionsPage> {
6585
],
6686
),
6787
),
68-
),
69-
body: TabBarView(
70-
children: [
71-
wifiModel.isWifiDeviceAvailable
72-
? const WifiDevicesContent()
73-
: const WifiAdaptorNotFound(),
74-
const SettingsPage(
75-
children: [
76-
Text('Ethernet - Please implement 🥲️'),
77-
],
78-
),
79-
const SettingsPage(
88+
Expanded(
89+
child: TabBarView(
90+
controller: _controller,
8091
children: [
81-
Text('Cellular - Please implement 🥲️'),
92+
wifiModel.isWifiDeviceAvailable
93+
? const WifiDevicesContent()
94+
: const WifiAdaptorNotFound(),
95+
const SettingsPage(
96+
children: [
97+
Text('Ethernet - Please implement 🥲️'),
98+
],
99+
),
100+
const SettingsPage(
101+
children: [
102+
Text('Cellular - Please implement 🥲️'),
103+
],
104+
),
82105
],
83106
),
84-
],
85-
),
107+
),
108+
],
86109
),
87110
);
88111
}

lib/view/pages/displays/displays_page.dart

+43-21
Original file line numberDiff line numberDiff line change
@@ -37,24 +37,43 @@ class DisplaysPage extends StatefulWidget {
3737
State<DisplaysPage> createState() => _DisplaysPageState();
3838
}
3939

40-
class _DisplaysPageState extends State<DisplaysPage> {
40+
class _DisplaysPageState extends State<DisplaysPage>
41+
with SingleTickerProviderStateMixin {
42+
late TabController _controller;
43+
44+
@override
45+
void initState() {
46+
super.initState();
47+
_controller =
48+
TabController(length: DisplaysPageSection.values.length, vsync: this);
49+
}
50+
51+
@override
52+
void dispose() {
53+
_controller.dispose();
54+
super.dispose();
55+
}
56+
4157
@override
4258
Widget build(BuildContext context) {
4359
final model = context.watch<DisplaysModel>();
4460

4561
return ValueListenableBuilder<DisplaysConfiguration?>(
4662
valueListenable: model.configuration,
4763
builder: (context, configurations, _) {
48-
return DefaultTabController(
49-
length: DisplaysPageSection.values.length,
50-
child: Scaffold(
51-
appBar: YaruWindowTitleBar(
52-
titleSpacing: 0,
53-
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
54-
border: BorderSide.none,
55-
title: SizedBox(
64+
return Scaffold(
65+
appBar: YaruWindowTitleBar(
66+
titleSpacing: 0,
67+
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
68+
border: BorderSide.none,
69+
title: Text(context.l10n.displaysPageTitle),
70+
),
71+
body: Column(
72+
children: [
73+
SizedBox(
5674
width: 300,
57-
child: TabBar(
75+
child: YaruTabBar(
76+
tabController: _controller,
5877
tabs: DisplaysPageSection.values
5978
.map(
6079
(e) => TitleBarTab(
@@ -65,17 +84,20 @@ class _DisplaysPageState extends State<DisplaysPage> {
6584
.toList(),
6685
),
6786
),
68-
),
69-
body: TabBarView(
70-
children: DisplaysPageSection.values
71-
.map(
72-
(e) => Padding(
73-
padding: const EdgeInsets.only(top: kYaruPagePadding),
74-
child: _buildPage(e, model, configurations),
75-
),
76-
)
77-
.toList(),
78-
),
87+
Expanded(
88+
child: TabBarView(
89+
controller: _controller,
90+
children: DisplaysPageSection.values
91+
.map(
92+
(e) => Padding(
93+
padding: const EdgeInsets.only(top: kYaruPagePadding),
94+
child: _buildPage(e, model, configurations),
95+
),
96+
)
97+
.toList(),
98+
),
99+
),
100+
],
79101
),
80102
);
81103
},

lib/view/pages/keyboard/keyboard_page.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class _KeyboardPageState extends State<KeyboardPage>
4545
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
4646
title: const SizedBox(
4747
width: 400,
48-
child: TabBar(
48+
child: YaruTabBar(
4949
tabs: [
5050
TitleBarTab(
5151
text: 'Keyboard Settings',

lib/view/pages/privacy/privacy_page.dart

+65-24
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import 'package:settings/view/pages/privacy/screen_saver_page.dart';
99
import 'package:settings/view/pages/settings_page.dart';
1010
import 'package:yaru/yaru.dart';
1111

12-
class PrivacyPage extends StatelessWidget {
12+
class PrivacyPage extends StatefulWidget {
1313
const PrivacyPage({super.key});
1414

1515
static Widget create(BuildContext context) => const PrivacyPage();
@@ -27,6 +27,26 @@ class PrivacyPage extends StatelessWidget {
2727
.contains(value.toLowerCase())
2828
: false;
2929

30+
@override
31+
State<PrivacyPage> createState() => _PrivacyPageState();
32+
}
33+
34+
class _PrivacyPageState extends State<PrivacyPage>
35+
with SingleTickerProviderStateMixin {
36+
late TabController _controller;
37+
38+
@override
39+
void initState() {
40+
super.initState();
41+
_controller = TabController(length: 6, vsync: this);
42+
}
43+
44+
@override
45+
void dispose() {
46+
_controller.dispose();
47+
super.dispose();
48+
}
49+
3050
@override
3151
Widget build(BuildContext context) {
3252
final content = <Widget, (IconData, String)>{
@@ -60,30 +80,51 @@ class PrivacyPage extends StatelessWidget {
6080
),
6181
};
6282

63-
return DefaultTabController(
64-
length: content.length,
65-
child: Scaffold(
66-
appBar: YaruWindowTitleBar(
67-
titleSpacing: 0,
68-
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
69-
border: BorderSide.none,
70-
title: TabBar(
71-
isScrollable: true,
72-
tabs: content.entries
73-
.map((e) => TitleBarTab(text: e.value.$2, iconData: e.value.$1))
74-
.toList(),
75-
),
76-
),
77-
body: TabBarView(
78-
children: content.entries
79-
.map(
80-
(e) => Padding(
81-
padding: const EdgeInsets.only(top: kYaruPagePadding),
82-
child: e.key,
83+
return Scaffold(
84+
appBar: YaruWindowTitleBar(
85+
titleSpacing: 0,
86+
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
87+
border: BorderSide.none,
88+
title: Text(context.l10n.privacyPageTitle),
89+
),
90+
body: Column(
91+
children: [
92+
Material(
93+
child: SizedBox(
94+
width: 550,
95+
child: SingleChildScrollView(
96+
scrollDirection: Axis.horizontal,
97+
child: SizedBox(
98+
width: 1000,
99+
child: YaruTabBar(
100+
tabController: _controller,
101+
tabs: content.entries
102+
.map(
103+
(e) => TitleBarTab(
104+
text: e.value.$2,
105+
iconData: e.value.$1,
106+
),
107+
)
108+
.toList(),
109+
),
83110
),
84-
)
85-
.toList(),
86-
),
111+
),
112+
),
113+
),
114+
Expanded(
115+
child: TabBarView(
116+
controller: _controller,
117+
children: content.entries
118+
.map(
119+
(e) => Padding(
120+
padding: const EdgeInsets.only(top: kYaruPagePadding),
121+
child: e.key,
122+
),
123+
)
124+
.toList(),
125+
),
126+
),
127+
],
87128
),
88129
);
89130
}

pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ dependencies:
5252
yaru:
5353
git:
5454
url: https://github.com/ubuntu/yaru.dart
55-
ref: reorganize
55+
ref: ba067738fe0a3887bf788b94295fd70a0e1cf908
5656

5757
dev_dependencies:
5858
build_runner: ^2.1.2

0 commit comments

Comments
 (0)