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

UI improvements for Android #21

Merged
merged 2 commits into from
Aug 2, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
7 changes: 7 additions & 0 deletions lib/src/common/services/global.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:cuckoo/src/common/services/moodle.dart';
import 'package:cuckoo/src/common/services/reminders.dart';
import 'package:cuckoo/src/common/services/settings.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:provider/provider.dart';
import 'package:provider/single_child_widget.dart';
import 'package:shared_preferences/shared_preferences.dart';
Expand All @@ -25,6 +26,12 @@ class Global {
WidgetsFlutterBinding.ensureInitialized();
prefs = await SharedPreferences.getInstance();

// Remove the background of the status bar and the gestures indicator.
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
statusBarColor: Colors.transparent,
systemNavigationBarColor: Colors.black.withOpacity(0.002)));
SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge);

// Init service modules.
Settings.init();
ColorRegistry.init();
Expand Down
8 changes: 8 additions & 0 deletions lib/src/routes/root.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import 'package:cuckoo/src/routes/calendar/calendar.dart';
import 'package:cuckoo/src/routes/settings/settings.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
import 'package:in_app_purchase/in_app_purchase.dart';
import 'package:persistent_bottom_nav_bar/persistent_tab_view.dart';
Expand Down Expand Up @@ -243,6 +244,13 @@ class RootState extends State<Root> with WidgetsBindingObserver {

@override
Widget build(BuildContext context) {
// Change the icon color according to the current theme.
final isDarkTheme = Theme.of(context).brightness == Brightness.dark;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can use context.isDarkMode as shortcut

final iconBrightness = isDarkTheme ? Brightness.light : Brightness.dark;
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
statusBarIconBrightness: iconBrightness,
systemNavigationBarIconBrightness: iconBrightness));

return PersistentTabView(
context,
controller: _controller,
Expand Down
8 changes: 4 additions & 4 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: cuckoo
description: "Cuckoo - HKU Moodle Client"
publish_to: 'none'
publish_to: "none"
version: 2.0.2+1

environment:
sdk: '>=3.3.2 <4.0.0'
sdk: ">=3.3.2 <4.0.0"
flutter: ">=3.19.0 <3.22.0"

dependencies:
Expand Down Expand Up @@ -44,7 +44,7 @@ dependencies:
flutter_animate: ^4.5.0
flutter_colorpicker: ^1.1.0
live_activities: ^1.9.3
home_widget: ^0.5.0
home_widget: ^0.6.0
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's keep this at 0.5.0 for now, as upgrading flutter to >=3.20 will cause problems in persistent_bottom_nav_bar. Will upgrade them in next versions


dev_dependencies:
json_model: ^1.0.0
Expand Down Expand Up @@ -83,4 +83,4 @@ flutter:
assets:
- images/illus/
- images/illus/dark/
- images/splash/
- images/splash/
Loading