Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: move tabs back to the page, add release bot #447

Merged
merged 1 commit into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Release

on:
push:
branches:
- master
workflow_dispatch:

jobs:
release:
permissions:
contents: write
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: googleapis/release-please-action@v4
with:
release-type: dart
11 changes: 11 additions & 0 deletions lib/app.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'dart:ui';

import 'package:flutter/material.dart';
import 'package:flutter_localized_locales/flutter_localized_locales.dart';
import 'package:provider/provider.dart';
Expand Down Expand Up @@ -28,6 +30,15 @@ class UbuntuSettingsApp extends StatelessWidget {
supportedLocales: AppLocalizations.supportedLocales,
localizationsDelegates: AppLocalizations.localizationsDelegates +
[const LocaleNamesLocalizationsDelegate()],
scrollBehavior: const MaterialScrollBehavior().copyWith(
dragDevices: {
PointerDeviceKind.mouse,
PointerDeviceKind.touch,
PointerDeviceKind.stylus,
PointerDeviceKind.unknown,
PointerDeviceKind.trackpad,
},
),
);
},
),
Expand Down
18 changes: 11 additions & 7 deletions lib/view/pages/apps/apps_page.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'dart:io';

import 'package:flutter/material.dart';
import 'package:settings/constants.dart';
import 'package:settings/l10n/l10n.dart';
import 'package:settings/view/pages/settings_page.dart';
import 'package:yaru/yaru.dart';
Expand All @@ -22,13 +23,16 @@ class AppsPage extends StatelessWidget {
Widget build(BuildContext context) {
return SettingsPage(
children: [
YaruSection(
child: YaruTile(
leading: const Text('Apps can be managed in the App Store'),
trailing: ElevatedButton.icon(
onPressed: () => Process.start('snap-store', []),
label: const Text('Open'),
icon: const Icon(YaruIcons.application_bag),
SizedBox(
width: kDefaultWidth,
child: YaruSection(
child: YaruTile(
leading: const Text('Apps can be managed in the App Store'),
trailing: ElevatedButton.icon(
onPressed: () => Process.start('snap-store', []),
label: const Text('Open'),
icon: const Icon(YaruIcons.application_bag),
),
),
),
),
Expand Down
77 changes: 50 additions & 27 deletions lib/view/pages/connections/connections_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,43 @@ class ConnectionsPage extends StatefulWidget {
State<ConnectionsPage> createState() => _ConnectionsPageState();
}

class _ConnectionsPageState extends State<ConnectionsPage> {
class _ConnectionsPageState extends State<ConnectionsPage>
with SingleTickerProviderStateMixin {
late TabController _controller;

@override
void initState() {
super.initState();
_controller = TabController(length: 3, vsync: this);
}

@override
void dispose() {
_controller.dispose();
super.dispose();
}

@override
Widget build(BuildContext context) {
final wifiModel = context.watch<WifiModel>();

return DefaultTabController(
length: 3,
child: Scaffold(
appBar: YaruWindowTitleBar(
titleSpacing: 20,
centerTitle: true,
border: BorderSide.none,
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
title: const SizedBox(
return Scaffold(
appBar: YaruWindowTitleBar(
titleSpacing: 20,
centerTitle: true,
border: BorderSide.none,
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
title: Text(context.l10n.connectionsPageTitle),
),
body: Column(
children: [
SizedBox(
width: 400,
child: TabBar(
tabs: [
child: YaruTabBar(
tabController: _controller,
tabs:
// TODO: localize
const [
TitleBarTab(
text: 'Wi-Fi',
iconData: YaruIcons.network_wireless,
Expand All @@ -65,24 +85,27 @@ class _ConnectionsPageState extends State<ConnectionsPage> {
],
),
),
),
body: TabBarView(
children: [
wifiModel.isWifiDeviceAvailable
? const WifiDevicesContent()
: const WifiAdaptorNotFound(),
const SettingsPage(
children: [
Text('Ethernet - Please implement 🥲️'),
],
),
const SettingsPage(
Expanded(
child: TabBarView(
controller: _controller,
children: [
Text('Cellular - Please implement 🥲️'),
wifiModel.isWifiDeviceAvailable
? const WifiDevicesContent()
: const WifiAdaptorNotFound(),
const SettingsPage(
children: [
Text('Ethernet - Please implement 🥲️'),
],
),
const SettingsPage(
children: [
Text('Cellular - Please implement 🥲️'),
],
),
],
),
],
),
),
],
),
);
}
Expand Down
64 changes: 43 additions & 21 deletions lib/view/pages/displays/displays_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,24 +37,43 @@ class DisplaysPage extends StatefulWidget {
State<DisplaysPage> createState() => _DisplaysPageState();
}

class _DisplaysPageState extends State<DisplaysPage> {
class _DisplaysPageState extends State<DisplaysPage>
with SingleTickerProviderStateMixin {
late TabController _controller;

@override
void initState() {
super.initState();
_controller =
TabController(length: DisplaysPageSection.values.length, vsync: this);
}

@override
void dispose() {
_controller.dispose();
super.dispose();
}

@override
Widget build(BuildContext context) {
final model = context.watch<DisplaysModel>();

return ValueListenableBuilder<DisplaysConfiguration?>(
valueListenable: model.configuration,
builder: (context, configurations, _) {
return DefaultTabController(
length: DisplaysPageSection.values.length,
child: Scaffold(
appBar: YaruWindowTitleBar(
titleSpacing: 0,
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
border: BorderSide.none,
title: SizedBox(
return Scaffold(
appBar: YaruWindowTitleBar(
titleSpacing: 0,
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
border: BorderSide.none,
title: Text(context.l10n.displaysPageTitle),
),
body: Column(
children: [
SizedBox(
width: 300,
child: TabBar(
child: YaruTabBar(
tabController: _controller,
tabs: DisplaysPageSection.values
.map(
(e) => TitleBarTab(
Expand All @@ -65,17 +84,20 @@ class _DisplaysPageState extends State<DisplaysPage> {
.toList(),
),
),
),
body: TabBarView(
children: DisplaysPageSection.values
.map(
(e) => Padding(
padding: const EdgeInsets.only(top: kYaruPagePadding),
child: _buildPage(e, model, configurations),
),
)
.toList(),
),
Expanded(
child: TabBarView(
controller: _controller,
children: DisplaysPageSection.values
.map(
(e) => Padding(
padding: const EdgeInsets.only(top: kYaruPagePadding),
child: _buildPage(e, model, configurations),
),
)
.toList(),
),
),
],
),
);
},
Expand Down
2 changes: 1 addition & 1 deletion lib/view/pages/keyboard/keyboard_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class _KeyboardPageState extends State<KeyboardPage>
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
title: const SizedBox(
width: 400,
child: TabBar(
child: YaruTabBar(
tabs: [
TitleBarTab(
text: 'Keyboard Settings',
Expand Down
89 changes: 65 additions & 24 deletions lib/view/pages/privacy/privacy_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import 'package:settings/view/pages/privacy/screen_saver_page.dart';
import 'package:settings/view/pages/settings_page.dart';
import 'package:yaru/yaru.dart';

class PrivacyPage extends StatelessWidget {
class PrivacyPage extends StatefulWidget {
const PrivacyPage({super.key});

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

@override
State<PrivacyPage> createState() => _PrivacyPageState();
}

class _PrivacyPageState extends State<PrivacyPage>
with SingleTickerProviderStateMixin {
late TabController _controller;

@override
void initState() {
super.initState();
_controller = TabController(length: 6, vsync: this);
}

@override
void dispose() {
_controller.dispose();
super.dispose();
}

@override
Widget build(BuildContext context) {
final content = <Widget, (IconData, String)>{
Expand Down Expand Up @@ -60,30 +80,51 @@ class PrivacyPage extends StatelessWidget {
),
};

return DefaultTabController(
length: content.length,
child: Scaffold(
appBar: YaruWindowTitleBar(
titleSpacing: 0,
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
border: BorderSide.none,
title: TabBar(
isScrollable: true,
tabs: content.entries
.map((e) => TitleBarTab(text: e.value.$2, iconData: e.value.$1))
.toList(),
),
),
body: TabBarView(
children: content.entries
.map(
(e) => Padding(
padding: const EdgeInsets.only(top: kYaruPagePadding),
child: e.key,
return Scaffold(
appBar: YaruWindowTitleBar(
titleSpacing: 0,
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
border: BorderSide.none,
title: Text(context.l10n.privacyPageTitle),
),
body: Column(
children: [
Material(
child: SizedBox(
width: 550,
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: SizedBox(
width: 1000,
child: YaruTabBar(
tabController: _controller,
tabs: content.entries
.map(
(e) => TitleBarTab(
text: e.value.$2,
iconData: e.value.$1,
),
)
.toList(),
),
),
)
.toList(),
),
),
),
),
Expanded(
child: TabBarView(
controller: _controller,
children: content.entries
.map(
(e) => Padding(
padding: const EdgeInsets.only(top: kYaruPagePadding),
child: e.key,
),
)
.toList(),
),
),
],
),
);
}
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ dependencies:
yaru:
git:
url: https://github.com/ubuntu/yaru.dart
ref: reorganize
ref: ba067738fe0a3887bf788b94295fd70a0e1cf908

dev_dependencies:
build_runner: ^2.1.2
Expand Down
Loading