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

Use updated yaru_widgets to fix tabbed views #245

Merged
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
19 changes: 11 additions & 8 deletions lib/view/pages/accessibility/accessibility_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import 'package:settings/view/pages/accessibility/hearing_section.dart';
import 'package:settings/view/pages/accessibility/pointing_and_clicking_section.dart';
import 'package:settings/view/pages/accessibility/seeing_section.dart';
import 'package:settings/view/pages/accessibility/typing_section.dart';
import 'package:yaru_widgets/yaru_widgets.dart';

class AccessibilityPage extends StatelessWidget {
const AccessibilityPage({Key? key}) : super(key: key);
Expand All @@ -21,14 +22,16 @@ class AccessibilityPage extends StatelessWidget {

@override
Widget build(BuildContext context) {
return Column(
children: const [
GlobalSection(),
SeeingSection(),
HearingSection(),
TypingSection(),
PointingAndClickingSection(),
],
return YaruPage(
child: Column(
children: const [
GlobalSection(),
SeeingSection(),
HearingSection(),
TypingSection(),
PointingAndClickingSection(),
],
),
);
}
}
13 changes: 8 additions & 5 deletions lib/view/pages/appearance/appearance_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:settings/services/settings_service.dart';
import 'package:settings/view/pages/appearance/appearance_model.dart';
import 'package:settings/view/pages/appearance/dark_mode_section.dart';
import 'package:settings/view/pages/appearance/dock_section.dart';
import 'package:yaru_widgets/yaru_widgets.dart';

class AppearancePage extends StatelessWidget {
const AppearancePage({Key? key}) : super(key: key);
Expand All @@ -18,11 +19,13 @@ class AppearancePage extends StatelessWidget {

@override
Widget build(BuildContext context) {
return Column(
children: const [
DarkModeSection(),
DockSection(),
],
return YaruPage(
child: Column(
children: const [
DarkModeSection(),
DockSection(),
],
),
);
}
}
42 changes: 22 additions & 20 deletions lib/view/pages/bluetooth/bluetooth_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,26 +30,28 @@ class _BluetoothPageState extends State<BluetoothPage> {
@override
Widget build(BuildContext context) {
final model = context.watch<BluetoothModel>();
return Column(
children: [
YaruSection(
headerWidget: const SizedBox(
height: 15,
width: 15,
child: CircularProgressIndicator(),
),
headline: 'Bluetooth devices',
children: [
ListView.builder(
shrinkWrap: true,
itemCount: model.devices.length,
itemBuilder: (context, index) => BluetoothDeviceRow.create(
context,
model.devices[index],
() => model.removeDevice(model.devices[index])),
)
]),
],
return YaruPage(
child: Column(
children: [
YaruSection(
headerWidget: const SizedBox(
height: 15,
width: 15,
child: CircularProgressIndicator(),
),
headline: 'Bluetooth devices',
children: [
ListView.builder(
shrinkWrap: true,
itemCount: model.devices.length,
itemBuilder: (context, index) => BluetoothDeviceRow.create(
context,
model.devices[index],
() => model.removeDevice(model.devices[index])),
)
]),
],
),
);
}
}
2 changes: 1 addition & 1 deletion lib/view/pages/connections/connections_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,6 @@ class _ConnectionsPageState extends State<ConnectionsPage>
Column(
children: const [Text('Cellular')],
)
], width: 516, height: 400);
], width: 516);
}
}
90 changes: 46 additions & 44 deletions lib/view/pages/connections/wifi_content.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,50 +15,52 @@ class WifiDevicesContent extends StatelessWidget {
Widget build(BuildContext context) {
final wifiModel = context.watch<WifiModel>();

return Column(
children: [
YaruRow(
enabled: true,
trailingWidget: const Text('Wi-Fi'),
actionWidget: Row(
children: [
Text(
wifiModel.isWifiEnabled ? 'connected' : 'disconnected',
style: TextStyle(
color: Theme.of(context)
.colorScheme
.onSurface
.withOpacity(0.5)),
),
Switch(
onChanged: (newValue) => wifiModel.toggleWifi(newValue),
value: wifiModel.isWifiEnabled),
],
)),
if (wifiModel.isWifiEnabled)
for (final wifiDevice in wifiModel.wifiDevices)
AnimatedBuilder(
animation: wifiDevice,
builder: (_, __) {
return YaruSection(
headline: 'Visible Networks',
children: [
for (final accessPoint in wifiDevice.accesPoints)
AccessPointTile(
accessPointModel: accessPoint,
onTap: () {
wifiModel.connectToAccesPoint(
accessPoint,
wifiDevice,
(wifiDevice, accessPoint) =>
authenticate(context, accessPoint),
);
},
)
],
);
})
],
return YaruPage(
child: Column(
children: [
YaruRow(
enabled: true,
trailingWidget: const Text('Wi-Fi'),
actionWidget: Row(
children: [
Text(
wifiModel.isWifiEnabled ? 'connected' : 'disconnected',
style: TextStyle(
color: Theme.of(context)
.colorScheme
.onSurface
.withOpacity(0.5)),
),
Switch(
onChanged: (newValue) => wifiModel.toggleWifi(newValue),
value: wifiModel.isWifiEnabled),
],
)),
if (wifiModel.isWifiEnabled)
for (final wifiDevice in wifiModel.wifiDevices)
AnimatedBuilder(
animation: wifiDevice,
builder: (_, __) {
return YaruSection(
headline: 'Visible Networks',
children: [
for (final accessPoint in wifiDevice.accesPoints)
AccessPointTile(
accessPointModel: accessPoint,
onTap: () {
wifiModel.connectToAccesPoint(
accessPoint,
wifiDevice,
(wifiDevice, accessPoint) =>
authenticate(context, accessPoint),
);
},
)
],
);
})
],
),
);
}

Expand Down
157 changes: 81 additions & 76 deletions lib/view/pages/info/info_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -52,82 +52,87 @@ class _InfoPageState extends State<InfoPage> {
),
);

return Column(
children: [
const SizedBox(
height: 128,
width: 128,
child: RiveAnimation.asset('assets/rive/ubuntu_cof.riv')),
const SizedBox(height: 10),
Text('${model.osName} ${model.osVersion}',
style: Theme.of(context).textTheme.headline5),
const SizedBox(height: 10),
const SizedBox(height: 30),
const _Computer(),
YaruSection(headline: 'Hardware', children: [
YaruSingleInfoRow(
infoLabel: 'Processor',
infoValue: '${model.processorName} x ${model.processorCount}',
),
YaruSingleInfoRow(
infoLabel: 'Memory',
infoValue: '${model.memory} Gb',
),
YaruSingleInfoRow(
infoLabel: 'Graphics',
infoValue: model.graphics,
),
YaruSingleInfoRow(
infoLabel: 'Disk Capacity',
infoValue:
model.diskCapacity != null ? filesize(model.diskCapacity) : '',
),
]),
YaruSection(headline: 'System', children: [
YaruSingleInfoRow(
infoLabel: 'OS',
infoValue:
'${model.osName} ${model.osVersion} (${model.osType}-bit)',
),
YaruSingleInfoRow(
infoLabel: 'Kernel version',
infoValue: model.kernelVersion,
),
YaruSingleInfoRow(
infoLabel: 'GNOME version',
infoValue: model.gnomeVersion,
),
YaruSingleInfoRow(
infoLabel: 'Windowing System',
infoValue: model.windowServer,
),
]),
YaruPageContainer(
child: Align(
alignment: Alignment.topRight,
child: OutlinedButton.icon(
icon: const Icon(YaruIcons.save_as),
label: const Text('Export to PDF'),
onPressed: () async {
// ignore: unused_local_variable
final pdfFile = await PdfApi.generateSystemData(
model.osName,
model.osVersion,
model.kernelVersion,
model.processorName,
model.processorCount.toString(),
model.memory.toString(),
model.graphics,
model.diskCapacity != null ? filesize(model.diskCapacity) : '',
model.osType.toString(),
model.gnomeVersion,
model.windowServer,
);
ScaffoldMessenger.of(context).showSnackBar(sysInfoSnackBar);
},
),
)),
],
return YaruPage(
child: Column(
children: [
const SizedBox(
height: 128,
width: 128,
child: RiveAnimation.asset('assets/rive/ubuntu_cof.riv')),
const SizedBox(height: 10),
Text('${model.osName} ${model.osVersion}',
style: Theme.of(context).textTheme.headline5),
const SizedBox(height: 10),
const SizedBox(height: 30),
const _Computer(),
YaruSection(headline: 'Hardware', children: [
YaruSingleInfoRow(
infoLabel: 'Processor',
infoValue: '${model.processorName} x ${model.processorCount}',
),
YaruSingleInfoRow(
infoLabel: 'Memory',
infoValue: '${model.memory} Gb',
),
YaruSingleInfoRow(
infoLabel: 'Graphics',
infoValue: model.graphics,
),
YaruSingleInfoRow(
infoLabel: 'Disk Capacity',
infoValue: model.diskCapacity != null
? filesize(model.diskCapacity)
: '',
),
]),
YaruSection(headline: 'System', children: [
YaruSingleInfoRow(
infoLabel: 'OS',
infoValue:
'${model.osName} ${model.osVersion} (${model.osType}-bit)',
),
YaruSingleInfoRow(
infoLabel: 'Kernel version',
infoValue: model.kernelVersion,
),
YaruSingleInfoRow(
infoLabel: 'GNOME version',
infoValue: model.gnomeVersion,
),
YaruSingleInfoRow(
infoLabel: 'Windowing System',
infoValue: model.windowServer,
),
]),
YaruPageContainer(
child: Align(
alignment: Alignment.topRight,
child: OutlinedButton.icon(
icon: const Icon(YaruIcons.save_as),
label: const Text('Export to PDF'),
onPressed: () async {
// ignore: unused_local_variable
final pdfFile = await PdfApi.generateSystemData(
model.osName,
model.osVersion,
model.kernelVersion,
model.processorName,
model.processorCount.toString(),
model.memory.toString(),
model.graphics,
model.diskCapacity != null
? filesize(model.diskCapacity)
: '',
model.osType.toString(),
model.gnomeVersion,
model.windowServer,
);
ScaffoldMessenger.of(context).showSnackBar(sysInfoSnackBar);
},
),
)),
],
),
);
}
}
Expand Down
10 changes: 5 additions & 5 deletions lib/view/pages/keyboard/keyboard_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ class _KeyboardPageState extends State<KeyboardPage>
@override
Widget build(BuildContext context) {
return const YaruTabbedPage(
tabIcons: [YaruIcons.input_keyboard, YaruIcons.keyboard_shortcuts],
tabTitles: ['Keyboard Settings', 'Keyboard Shortcuts'],
views: [KeyboardSettingsPage(), KeyboardShortcutsPage()],
width: 512,
height: 1000);
tabIcons: [YaruIcons.input_keyboard, YaruIcons.keyboard_shortcuts],
tabTitles: ['Keyboard Settings', 'Keyboard Shortcuts'],
views: [KeyboardSettingsPage(), KeyboardShortcutsPage()],
width: 512,
);
}
}
Loading