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 several warnings #280

Merged
merged 1 commit into from
Feb 21, 2022
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
26 changes: 0 additions & 26 deletions lib/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -70,29 +70,3 @@ class _UbuntuSettingsAppState extends State<UbuntuSettingsApp> {
);
}
}

class MySearchDelegate extends SearchDelegate<String> {
@override
List<Widget>? buildActions(BuildContext context) {
// TODO: implement buildActions
throw UnimplementedError();
}

@override
Widget? buildLeading(BuildContext context) {
// TODO: implement buildLeading
throw UnimplementedError();
}

@override
Widget buildResults(BuildContext context) {
// TODO: implement buildResults
throw UnimplementedError();
}

@override
Widget buildSuggestions(BuildContext context) {
// TODO: implement buildSuggestions
throw UnimplementedError();
}
}
4 changes: 3 additions & 1 deletion lib/services/settings_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,17 @@ class Settings {
T? getValue<T>(String key) => _values[key] ?? _updateValue(key);

T? _updateValue<T>(String key) {
T? value;
try {
_settings.get(key).then((v) {
final value = v.toNative() as T?;
value = v.toNative() as T?;
if (_values[key] != value) {
_values[key] = value;
notifyListeners();
}
});
} on GSettingsUnknownKeyException catch (_) {}
return value;
}

Future<void> setValue<T>(String key, T value) async {
Expand Down
14 changes: 11 additions & 3 deletions lib/view/pages/connections/models/wifi_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@ class WifiModel extends PropertyStreamNotifier {
addPropertyListener('NetworkingEnabled', notifyListeners);
}

String _errorMessage = '';
set errorMessage(String value) {
_errorMessage = value;
notifyListeners();
}

String get errorMessage => _errorMessage;

void connectToAccesPoint(
AccessPointModel accessPointModel,
WifiDeviceModel wifiAdaptorModel,
Expand Down Expand Up @@ -71,10 +79,9 @@ class WifiModel extends PropertyStreamNotifier {
accessPoint: accessPointModel._networkManagerAccessPoint,
);
} on DBusMethodResponseException catch (e) {
//TODO: reflect error on ui
errorMessage = e.toString();
} on Exception catch (e) {
//TODO: reflect error on ui

errorMessage = e.toString();
}
}

Expand All @@ -83,6 +90,7 @@ class WifiModel extends PropertyStreamNotifier {
await _networkManagerClient.setWirelessEnabled(value);
return true;
} on Exception catch (e) {
errorMessage = e.toString();
return false;
}
}
Expand Down
23 changes: 14 additions & 9 deletions lib/view/pages/connections/wifi_content.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@ class WifiDevicesContent extends StatelessWidget {

return YaruPage(
children: [
YaruRow(
YaruSwitchRow(
width: kDefaultWidth,
enabled: true,
trailingWidget: const Text('Wi-Fi'),
actionWidget: Row(
enabled: wifiModel.isWifiDeviceAvailable,
trailingWidget: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(context.l10n.wifiPageTitle),
Text(
wifiModel.isWifiEnabled
? context.l10n.connected
Expand All @@ -34,12 +35,11 @@ class WifiDevicesContent extends StatelessWidget {
.colorScheme
.onSurface
.withOpacity(0.5)),
),
Switch(
onChanged: (newValue) => wifiModel.toggleWifi(newValue),
value: wifiModel.isWifiEnabled),
)
],
)),
),
onChanged: (newValue) => wifiModel.toggleWifi(newValue),
value: wifiModel.isWifiEnabled),
if (wifiModel.isWifiEnabled)
for (final wifiDevice in wifiModel.wifiDevices)
AnimatedBuilder(
Expand All @@ -59,6 +59,11 @@ class WifiDevicesContent extends StatelessWidget {
(wifiDevice, accessPoint) =>
authenticate(context, accessPoint),
);
if (wifiModel.errorMessage.isNotEmpty) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(wifiModel.errorMessage)));
}
},
)
],
Expand Down
2 changes: 0 additions & 2 deletions lib/view/pages/keyboard/special_characters_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ class SpecialCharactersModel extends SafeChangeNotifier {
return ComposeOptions.defaultLayout;
}

// TODO: Add translations here
final composeOptionsToStringMap = <ComposeOptions, String>{
ComposeOptions.rightAlt: 'Right Alt-Key',
ComposeOptions.leftAlt: 'Left Alt-Key',
Expand Down Expand Up @@ -146,7 +145,6 @@ class SpecialCharactersModel extends SafeChangeNotifier {
return null;
}

// TODO: add translations here
final lv3OptionsToStringMap = <Lv3Options?, String>{
null: 'Default Layout',
Lv3Options.none: 'None',
Expand Down
27 changes: 8 additions & 19 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -653,13 +653,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.0"
scrollable_positioned_list:
dependency: "direct main"
description:
name: scrollable_positioned_list
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.3"
shelf:
dependency: transitive
description:
Expand Down Expand Up @@ -934,12 +927,10 @@ packages:
yaru:
dependency: "direct main"
description:
path: "."
ref: HEAD
resolved-ref: "29c88e53046b8a1ef9eb514eb702437f4c003009"
url: "https://github.com/ubuntu/yaru.dart"
source: git
version: "0.2.1"
name: yaru
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.2"
yaru_icons:
dependency: "direct main"
description:
Expand All @@ -950,12 +941,10 @@ packages:
yaru_widgets:
dependency: "direct main"
description:
path: "."
ref: HEAD
resolved-ref: "5148015afc952dbe0770aea4af44f7abaf921be8"
url: "https://github.com/ubuntu/yaru_widgets.dart"
source: git
version: "1.0.5"
name: yaru_widgets
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.6"
sdks:
dart: ">=2.16.0-100.0.dev <3.0.0"
flutter: ">=2.8.0"
9 changes: 2 additions & 7 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,11 @@ dependencies:
provider: ^6.0.1
rive: ^0.8.1
safe_change_notifier: ^0.1.0
scrollable_positioned_list: ^0.2.0-nullsafety.0
udisks: ^0.3.0
upower: ^0.6.2
yaru:
git:
url: https://github.com/ubuntu/yaru.dart
yaru: ^0.2.2
yaru_icons: ^0.1.2
yaru_widgets:
git:
url: https://github.com/ubuntu/yaru_widgets.dart
yaru_widgets: ^1.0.6
flutter_svg: ^1.0.0
flutter_spinbox: ^0.8.0
http: ^0.13.4
Expand Down