Skip to content

settings: Upgrade Flutter; migrate to new RadioGroup API #1546

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
163 changes: 92 additions & 71 deletions ios/Runner/Info.plist
Original file line number Diff line number Diff line change
@@ -1,75 +1,96 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
<string>Zulip beta</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>Zulip beta</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>$(FLUTTER_BUILD_NAME)</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>com.zulip.flutter</string>
<key>CFBundleURLSchemes</key>
<array>
<string>zulip</string>
</array>
</dict>
</array>
<key>CFBundleVersion</key>
<string>$(FLUTTER_BUILD_NUMBER)</string>
<key>FlutterDeepLinkingEnabled</key>
<true/>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSCameraUsageDescription</key>
<string>By allowing camera access, you can take photos and send them in Zulip messages.</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Choose photos from your library and send them in Zulip messages.</string>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
<key>UIBackgroundModes</key>
<array>
<string>fetch</string>
<string>remote-notification</string>
</array>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
</dict>
<dict>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
<string>Zulip beta</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>Zulip beta</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>$(FLUTTER_BUILD_NAME)</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>com.zulip.flutter</string>
<key>CFBundleURLSchemes</key>
<array>
<string>zulip</string>
</array>
</dict>
</array>
<key>CFBundleVersion</key>
<string>$(FLUTTER_BUILD_NUMBER)</string>
<key>FlutterDeepLinkingEnabled</key>
<true/>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSCameraUsageDescription</key>
<string>By allowing camera access, you can take photos and send them in Zulip messages.</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Choose photos from your library and send them in Zulip messages.</string>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
<key>UIBackgroundModes</key>
<array>
<string>fetch</string>
<string>remote-notification</string>
</array>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>UIApplicationSceneManifest</key>
<dict>
<key>UIApplicationSupportsMultipleScenes</key>
<false/>
<key>UISceneConfigurations</key>
<dict>
<key>UIWindowSceneSessionRoleApplication</key>
<array>
<dict>
<key>UISceneClassName</key>
<string>UIWindowScene</string>
<key>UISceneDelegateClassName</key>
<string>FlutterSceneDelegate</string>
<key>UISceneConfigurationName</key>
<string>flutter</string>
<key>UISceneStoryboardFile</key>
<string>Main</string>
</dict>
</array>
</dict>
</dict>
</dict>
</plist>
25 changes: 13 additions & 12 deletions lib/widgets/settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,19 @@ class _ThemeSetting extends StatelessWidget {
Widget build(BuildContext context) {
final zulipLocalizations = ZulipLocalizations.of(context);
final globalSettings = GlobalStoreWidget.settingsOf(context);
return Column(
children: [
ListTile(title: Text(zulipLocalizations.themeSettingTitle)),
for (final themeSettingOption in [null, ...ThemeSetting.values])
RadioListTile<ThemeSetting?>.adaptive(
title: Text(ThemeSetting.displayName(
themeSetting: themeSettingOption,
zulipLocalizations: zulipLocalizations)),
value: themeSettingOption,
groupValue: globalSettings.themeSetting,
onChanged: (newValue) => _handleChange(context, newValue)),
]);
return RadioGroup<ThemeSetting?>(
groupValue: globalSettings.themeSetting,
onChanged: (newValue) => _handleChange(context, newValue),
child: Column(
children: [
ListTile(title: Text(zulipLocalizations.themeSettingTitle)),
for (final themeSettingOption in [null, ...ThemeSetting.values])
RadioListTile<ThemeSetting?>.adaptive(
title: Text(ThemeSetting.displayName(
themeSetting: themeSettingOption,
zulipLocalizations: zulipLocalizations)),
value: themeSettingOption),
]));
}
}

Expand Down
20 changes: 10 additions & 10 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1079,26 +1079,26 @@ packages:
dependency: "direct dev"
description:
name: test
sha256: "301b213cd241ca982e9ba50266bd3f5bd1ea33f1455554c5abb85d1be0e2d87e"
sha256: "65e29d831719be0591f7b3b1a32a3cda258ec98c58c7b25f7b84241bc31215bb"
url: "https://pub.dev"
source: hosted
version: "1.25.15"
version: "1.26.2"
test_api:
dependency: "direct dev"
description:
name: test_api
sha256: fb31f383e2ee25fbbfe06b40fe21e1e458d14080e3c67e7ba0acfde4df4e0bbd
sha256: "522f00f556e73044315fa4585ec3270f1808a4b186c936e612cab0b565ff1e00"
url: "https://pub.dev"
source: hosted
version: "0.7.4"
version: "0.7.6"
test_core:
dependency: transitive
description:
name: test_core
sha256: "84d17c3486c8dfdbe5e12a50c8ae176d15e2a771b96909a9442b40173649ccaa"
sha256: "80bf5a02b60af04b09e14f6fe68b921aad119493e26e490deaca5993fef1b05a"
url: "https://pub.dev"
source: hosted
version: "0.6.8"
version: "0.6.11"
timing:
dependency: transitive
description:
Expand Down Expand Up @@ -1191,10 +1191,10 @@ packages:
dependency: transitive
description:
name: vector_math
sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803"
sha256: d530bd74fea330e6e364cda7a85019c434070188383e1cd8d9777ee586914c5b
url: "https://pub.dev"
source: hosted
version: "2.1.4"
version: "2.2.0"
video_player:
dependency: "direct main"
description:
Expand Down Expand Up @@ -1355,5 +1355,5 @@ packages:
source: path
version: "0.0.1"
sdks:
dart: ">=3.9.0-114.0.dev <4.0.0"
flutter: ">=3.33.0-1.0.pre.44"
dart: ">=3.9.0-172.0.dev <4.0.0"
flutter: ">=3.33.0-1.0.pre.347"
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ environment:
# We use a recent version of Flutter from its main channel, and
# the corresponding recent version of the Dart SDK.
# Feel free to update these regularly; see README.md for instructions.
sdk: '>=3.9.0-114.0.dev <4.0.0'
flutter: '>=3.33.0-1.0.pre.44' # 358b0726882869cd917e1e2dc07b6c298e6c2992
sdk: '>=3.9.0-172.0.dev <4.0.0'
flutter: '>=3.33.0-1.0.pre.347' # d2e4017f8174fcb71baeb17d6210c4b51f59c564

# To update dependencies, see instructions in README.md.
dependencies:
Expand Down
4 changes: 0 additions & 4 deletions test/flutter_checks.dart
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,3 @@ extension IconButtonChecks on Subject<IconButton> {
extension SwitchListTileChecks<T> on Subject<SwitchListTile> {
Subject<bool> get value => has((x) => x.value, 'value');
}

extension RadioListTileChecks<T> on Subject<RadioListTile<T>> {
Subject<bool> get checked => has((x) => x.checked, 'checked');
}
16 changes: 13 additions & 3 deletions test/widgets/settings_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:checks/checks.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:legacy_checks/legacy_checks.dart';
import 'package:zulip/model/settings.dart';
import 'package:zulip/widgets/settings.dart';

Expand Down Expand Up @@ -39,9 +40,18 @@ void main() {
ThemeSetting.dark => 'Dark',
};
for (final title in ['System', 'Light', 'Dark']) {
check(tester.widget<RadioListTile<ThemeSetting?>>(
findRadioListTileWithTitle(title)))
.checked.equals(title == expectedCheckedTitle);
final expectedIsChecked = title == expectedCheckedTitle;
final element = tester.element(findRadioListTileWithTitle(title));
final checkedColor = Theme.of(element).colorScheme.primary;
// `paints` isn't a [Matcher] so we wrap it with `equals`;
// awkward but it works
final paintsAsCheckedMatcher = equals(paints..circle(color: checkedColor));
check(because: '$title should be ${expectedIsChecked ? 'checked' : 'unchecked'}',
element.renderObject,
).legacyMatcher(
expectedIsChecked
? paintsAsCheckedMatcher
: isNot(paintsAsCheckedMatcher));
}
check(testBinding.globalStore)
.settings.themeSetting.equals(expectedThemeSetting);
Expand Down