Skip to content

Commit

Permalink
Merge branch 'master' into printers_page
Browse files Browse the repository at this point in the history
  • Loading branch information
Feichtmeier authored Feb 3, 2024
2 parents 948de9d + 14421b1 commit 7aa8e6c
Show file tree
Hide file tree
Showing 108 changed files with 1,144 additions and 2,249 deletions.
Binary file added .github/images/dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/images/light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed .github/images/settings.png
Binary file not shown.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
workflow_dispatch:

env:
FLUTTER_VERSION: 3.10.x
FLUTTER_VERSION: 3.16.x

jobs:
analyze:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,4 @@ android/app/.classpath
android/app/.project
android/app/.settings/org.eclipse.buildship.core.prefs
.vscode/
pubspec.lock
60 changes: 28 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,49 +1,30 @@
# Unofficial Ubuntu Desktop Settings App made with Flutter - WIP
# Settings App for the Ubuntu Desktop

The goal of this project is to build a feature complete settings app for the Ubuntu desktop with the Flutter UI toolkit.
The goal of this project is to build a feature complete settings app for the Ubuntu desktop (GNOME, gtk and gnome-shell) with the Flutter UI toolkit.

![](.github/images/settings.png)
| Light | Dark
| - | - |
| ![](.github/images/light.png) | ![](.github/images/dark.png) |

Mentionable packages that we use and want to thank are:
# Releases

- [gsettings.dart](https://github.com/canonical/gsettings.dart)
- [bluez.dart](https://github.com/canonical/bluez.dart)
- [nm.dart](https://github.com/canonical/nm.dart)
- [yaru.dart](https://github.com/ubuntu/yaru.dart)
- [yaru_icons.dart](https://github.com/ubuntu/yaru_icons.dart)
- [yaru_widgets.dart](https://github.com/ubuntu/yaru_widgets.dart)
- [dbus.dart](https://github.com/canonical/dbus.dart)
- [upower.dart](https://github.com/canonical/upower.dart)
- [udisks.dart](https://github.com/canonical/udisks.dart)
- [flex_color_picker](https://github.com/rydmike/flex_color_picker)


# Alpha Releases / Download

Currently the app is in a very raw alpha state and pages are still missing.
However if you want you can download, extract and then run alpha releases [from the releases page](https://github.com/Feichtmeier/settings/releases).
The app will be soon available as a snap.

# Building

The following steps are needed to run the app from the source code.

## Install Flutter

Either with

```bash
sudo snap install flutter --classic
sudo apt -y install git curl cmake meson make clang libgtk-3-dev pkg-config && mkdir -p ~/development && cd ~/development && git clone https://github.com/flutter/flutter.git -b stable && echo 'export PATH="$PATH:$HOME/development/flutter/bin"' >> ~/.bashrc && source ~/.bashrc
```

Or with
## Run

```bash
sudo apt install git curl cmake meson make clang libgtk-3-dev pkg-config
mkdir ~/development
cd ~/development
git clone https://github.com/flutter/flutter.git -b master
echo 'export PATH="$PATH:$HOME/development/flutter/bin"' >> ~/.bashrc
source ~/.bashrc
Run the app with vscode or with
```dart
flutter run
```

# TODO
Expand All @@ -61,7 +42,7 @@ source ~/.bashrc
- [X] Multi-Tasking page
- [X] Notifications page
- [ ] Search page
- [ ] Apps page
- [X] Apps page (forward to snap-store)
- [X] Privacy/Security page - WIP
- [ ] Online Accounts page
- [ ] Sound page - WIP
Expand All @@ -79,3 +60,18 @@ source ~/.bashrc
- [X] Date and time page
- [ ] Wacom page
- [X] Info page

## Contributing

This project really needs help to finish the last pages and also in the future when the GNOME desktop changes. Any help is welcome!


However for new contributors please follow those rules:

- do not over complicate things
- stick to the service, viewmodel, view approach
- as long as we stick to the provider package try to avoid context.watch as much as possible and always prefer context.select
- as long as we stick to the provider package try to avoid provider calls as much as possible and prefer to forward callbacks and values where you can
- do not split files with [the part keyword](https://dart.dev/guides/libraries/create-packages#organizing-a-package)
- do not shadow function definitions with [typedef](https://dart.dev/language/typedefs)
- use absolute imports
58 changes: 37 additions & 21 deletions lib/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import 'package:flutter_localized_locales/flutter_localized_locales.dart';
import 'package:provider/provider.dart';
import 'package:settings/app_model.dart';
import 'package:settings/l10n/l10n.dart';
import 'package:settings/schemas/schemas.dart';
import 'package:settings/services/settings_service.dart';
import 'package:settings/view/app_theme.dart';
import 'package:settings/view/pages/page_items.dart';
import 'package:yaru/yaru.dart';
import 'package:yaru_widgets/yaru_widgets.dart';
Expand All @@ -14,19 +17,22 @@ class UbuntuSettingsApp extends StatelessWidget {

@override
Widget build(BuildContext context) {
return YaruTheme(
builder: (context, yaru, child) {
return MaterialApp(
theme: yaru.theme,
darkTheme: yaru.darkTheme,
debugShowCheckedModeBanner: false,
onGenerateTitle: (context) => context.l10n.appTitle,
home: App.create(context),
supportedLocales: AppLocalizations.supportedLocales,
localizationsDelegates: AppLocalizations.localizationsDelegates +
[const LocaleNamesLocalizationsDelegate()],
);
},
return ChangeNotifierProvider(
create: (_) => AppTheme(Settings(schemaInterface)),
child: YaruTheme(
builder: (context, yaru, child) {
return MaterialApp(
theme: yaru.theme,
darkTheme: yaru.darkTheme,
debugShowCheckedModeBanner: false,
onGenerateTitle: (context) => context.l10n.appTitle,
home: App.create(context),
supportedLocales: AppLocalizations.supportedLocales,
localizationsDelegates: AppLocalizations.localizationsDelegates +
[const LocaleNamesLocalizationsDelegate()],
);
},
),
);
}
}
Expand Down Expand Up @@ -64,19 +70,29 @@ class App extends StatelessWidget {
paneWidth: 270,
),
length: items.length,
tileBuilder: (context, index, selected, availableWidth) => YaruMasterTile(
title: items[index].titleBuilder(context),
leading: items[index].iconBuilder(context, selected),
tileBuilder: (context, index, selected, availableWidth) => IconTheme(
data: Theme.of(context).iconTheme.copyWith(size: 21),
child: YaruMasterTile(
title: items[index].titleBuilder(context),
leading: items[index].iconBuilder(context, selected),
),
),
pageBuilder: (context, index) => YaruDetailPage(
body: items[index].builder(context),
appBar: YaruWindowTitleBar(
title: items[index].titleBuilder(context),
leading:
Navigator.of(context).canPop() ? const YaruBackButton() : null,
),
appBar: items[index].hasAppBar == false
? null
: YaruWindowTitleBar(
border: BorderSide.none,
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
title: items[index].titleBuilder(context),
leading: Navigator.of(context).canPop()
? const YaruBackButton()
: null,
),
),
appBar: YaruWindowTitleBar(
border: BorderSide.none,
backgroundColor: YaruMasterDetailTheme.of(context).sideBarColor,
titleSpacing: 0,
leading: YaruSearchButton(
onPressed: () => model.setSearchActive(!(searchActive ?? false)),
Expand Down
133 changes: 62 additions & 71 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import 'package:bluez/bluez.dart';
import 'package:flutter/material.dart';
import 'package:linux_datetime_service/linux_datetime.dart';
import 'package:nm/nm.dart';
import 'package:provider/provider.dart';
import 'package:settings/app.dart';
import 'package:settings/schemas/schemas.dart';
import 'package:settings/services/bluetooth_service.dart';
import 'package:settings/services/date_time_service.dart';
import 'package:settings/services/display/display_service.dart';
import 'package:settings/services/hostname_service.dart';
import 'package:settings/services/house_keeping_service.dart';
Expand All @@ -15,82 +13,75 @@ import 'package:settings/services/locale_service.dart';
import 'package:settings/services/power_profile_service.dart';
import 'package:settings/services/power_settings_service.dart';
import 'package:settings/services/settings_service.dart';
import 'package:settings/view/app_theme.dart';
import 'package:ubuntu_service/ubuntu_service.dart';
import 'package:udisks/udisks.dart';
import 'package:upower/upower.dart';
import 'package:xdg_accounts/xdg_accounts.dart';
import 'package:yaru_widgets/yaru_widgets.dart';

void main() async {
final themeSettings = Settings(schemaInterface);
await YaruWindowTitleBar.ensureInitialized();

final networkManagerClient = NetworkManagerClient();
await networkManagerClient.connect();

await YaruWindowTitleBar.ensureInitialized();

runApp(
MultiProvider(
providers: [
ChangeNotifierProvider(
create: (_) => AppTheme(themeSettings),
),
Provider<BluetoothService>(
create: (_) => BluetoothService(),
dispose: (_, service) => service.dispose(),
),
Provider<HostnameService>(
create: (_) => HostnameService(),
dispose: (_, service) => service.dispose(),
),
Provider<KeyboardService>(
create: (_) => KeyboardMethodChannel(),
),
Provider<NetworkManagerClient>.value(value: networkManagerClient),
Provider<PowerProfileService>(
create: (_) => PowerProfileService(),
dispose: (_, service) => service.dispose(),
),
Provider<PowerSettingsService>(
create: (_) => PowerSettingsService(),
dispose: (_, service) => service.dispose(),
),
Provider<SettingsService>(
create: (_) => SettingsService(),
dispose: (_, service) => service.dispose(),
),
Provider<UDisksClient>(
create: (_) => UDisksClient(),
dispose: (_, client) => client.close(),
),
Provider<UPowerClient>(
create: (_) => UPowerClient(),
dispose: (_, client) => client.close(),
),
Provider<BlueZClient>(
create: (_) => BlueZClient(),
dispose: (_, client) => client.close(),
),
Provider<InputSourceService>(
create: (_) => InputSourceService(),
),
Provider<HouseKeepingService>(
create: (_) => HouseKeepingService(),
dispose: (_, service) => service.dispose(),
),
Provider<DateTimeService>(
create: (_) => DateTimeService(),
dispose: (_, service) => service.dispose(),
),
Provider<LocaleService>(
create: (_) => LocaleService(),
dispose: (_, service) => service.dispose(),
),
Provider<DisplayService>(
create: (_) => DisplayService(),
dispose: (_, service) => service.dispose(),
),
],
child: const UbuntuSettingsApp(),
),
registerService<BluetoothService>(
BluetoothService.new,
dispose: (s) => s.dispose(),
);
registerService<HostnameService>(
HostnameService.new,
dispose: (s) => s.dispose(),
);
registerService<KeyboardService>(
KeyboardMethodChannel.new,
);
registerService<NetworkManagerClient>(() => networkManagerClient);
registerService<PowerProfileService>(
PowerProfileService.new,
dispose: (s) => s.dispose(),
);
registerService<PowerSettingsService>(
PowerSettingsService.new,
dispose: (s) => s.dispose(),
);
registerService<SettingsService>(
SettingsService.new,
dispose: (s) => s.dispose(),
);
registerService<UDisksClient>(
UDisksClient.new,
dispose: (client) => client.close(),
);
registerService<UPowerClient>(
UPowerClient.new,
dispose: (client) => client.close(),
);
registerService<BlueZClient>(
BlueZClient.new,
dispose: (client) => client.close(),
);
registerService<InputSourceService>(InputSourceService.new);
registerService<HouseKeepingService>(
HouseKeepingService.new,
dispose: (s) => s.dispose(),
);
registerService<DateTimeService>(
DateTimeService.new,
dispose: (s) => s.dispose(),
);
registerService<LocaleService>(
LocaleService.new,
dispose: (s) => s.dispose(),
);
registerService<DisplayService>(
DisplayService.new,
dispose: (s) => s.dispose(),
);
registerService<XdgAccounts>(
XdgAccounts.new,
dispose: (s) => s.dispose(),
);

runApp(const UbuntuSettingsApp());
}
Loading

0 comments on commit 7aa8e6c

Please sign in to comment.