Skip to content

Commit

Permalink
fixed inconsistency of colors in about screen
Browse files Browse the repository at this point in the history
  • Loading branch information
sheikhhaziq committed Jul 17, 2024
1 parent 40a4aff commit 2ec7cbf
Show file tree
Hide file tree
Showing 8 changed files with 101 additions and 100 deletions.
1 change: 1 addition & 0 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
<!-- ALSO ADD THIS PERMISSION IF TARGETING SDK 34 -->
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK"/>
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS"/>

<application
android:label="Gyawun Beta"
Expand Down
7 changes: 3 additions & 4 deletions lib/screens/home_screen/section_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -435,14 +435,13 @@ class _ItemListState extends State<ItemList> {
mainAxisAlignment: MainAxisAlignment.center,
children: [
AdaptiveListTile(
contentPadding: EdgeInsets.symmetric(
horizontal: Platform.isWindows ? 0 : 8,
vertical: 4,
),
contentPadding: const EdgeInsets.symmetric(
horizontal: 0, vertical: 4),
title: Text(
items[index]['title'].toString().breakWord,
maxLines: 2,
style: const TextStyle(height: 1.3),
overflow: TextOverflow.ellipsis,
softWrap: true,
),
subtitle: Row(
Expand Down
7 changes: 0 additions & 7 deletions lib/screens/main_screen/main_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -198,13 +198,6 @@ class _MainScreenState extends State<MainScreen> with WindowListener {
Expanded(
child: widget.navigationShell,
),
// if (screenWidth >= 700 &&
// MediaQuery.of(context).size.height >= 600 &&
// context.watch<MediaPlayer>().currentSongNotifier.value !=
// null)
// SizedBox(
// width: Platform.isWindows ? 450 : 350,
// child: const PlayerScreen())
],
),
),
Expand Down
53 changes: 35 additions & 18 deletions lib/screens/settings_screen/about/about_screen.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:gyawun_beta/screens/settings_screen/color_icon.dart';
import 'package:url_launcher/url_launcher.dart';

import '../../../app_config.dart';
Expand Down Expand Up @@ -50,10 +51,11 @@ class AboutScreen extends StatelessWidget {
const SizedBox(height: 16),
AdaptiveListTile(
margin: const EdgeInsets.symmetric(vertical: 4),
leading: const Icon(Icons.title),
leading: const ColorIcon(icon: Icons.title, color: null),
title: Text(
S.of(context).Name,
style: subtitleTextStyle(context),
style: textStyle(context, bold: false)
.copyWith(fontSize: 16),
),
trailing: Text(
S.of(context).Gyawun,
Expand All @@ -62,10 +64,12 @@ class AboutScreen extends StatelessWidget {
),
AdaptiveListTile(
margin: const EdgeInsets.symmetric(vertical: 4),
leading: const Icon(Icons.new_releases),
leading: const ColorIcon(
color: null, icon: Icons.new_releases),
title: Text(
S.of(context).Version,
style: subtitleTextStyle(context),
style: textStyle(context, bold: false)
.copyWith(fontSize: 16),
),
trailing: Text(
appConfig.codeName,
Expand All @@ -74,10 +78,12 @@ class AboutScreen extends StatelessWidget {
),
AdaptiveListTile(
margin: const EdgeInsets.symmetric(vertical: 4),
leading: const Icon(CupertinoIcons.person),
leading: const ColorIcon(
color: null, icon: CupertinoIcons.person),
title: Text(
S.of(context).Developer,
style: subtitleTextStyle(context),
style: textStyle(context, bold: false)
.copyWith(fontSize: 16),
),
trailing: Wrap(
alignment: WrapAlignment.center,
Expand All @@ -98,10 +104,12 @@ class AboutScreen extends StatelessWidget {
),
AdaptiveListTile(
margin: const EdgeInsets.symmetric(vertical: 4),
leading: const Icon(Icons.other_houses),
leading: const ColorIcon(
color: null, icon: Icons.other_houses),
title: Text(
S.of(context).Organisation,
style: subtitleTextStyle(context),
style: textStyle(context, bold: false)
.copyWith(fontSize: 16),
),
trailing: Wrap(
alignment: WrapAlignment.center,
Expand All @@ -122,10 +130,12 @@ class AboutScreen extends StatelessWidget {
),
AdaptiveListTile(
margin: const EdgeInsets.symmetric(vertical: 4),
leading: const Icon(Icons.telegram_outlined),
leading: const ColorIcon(
color: null, icon: Icons.telegram_outlined),
title: Text(
S.of(context).Telegram,
style: subtitleTextStyle(context),
style: textStyle(context, bold: false)
.copyWith(fontSize: 16),
),
trailing: Icon(AdaptiveIcons.chevron_right),
onTap: () => launchUrl(
Expand All @@ -134,10 +144,12 @@ class AboutScreen extends StatelessWidget {
),
AdaptiveListTile(
margin: const EdgeInsets.symmetric(vertical: 4),
leading: const Icon(CupertinoIcons.person_3),
leading: const ColorIcon(
color: null, icon: CupertinoIcons.person_3),
title: Text(
S.of(context).Contributors,
style: subtitleTextStyle(context),
style: textStyle(context, bold: false)
.copyWith(fontSize: 16),
),
trailing: Icon(AdaptiveIcons.chevron_right),
onTap: () => launchUrl(
Expand All @@ -147,10 +159,11 @@ class AboutScreen extends StatelessWidget {
),
AdaptiveListTile(
margin: const EdgeInsets.symmetric(vertical: 4),
leading: const Icon(Icons.code),
leading: const ColorIcon(color: null, icon: Icons.code),
title: Text(
S.of(context).Source_Code,
style: subtitleTextStyle(context),
style: textStyle(context, bold: false)
.copyWith(fontSize: 16),
),
trailing: Icon(AdaptiveIcons.chevron_right),
onTap: () => launchUrl(
Expand All @@ -159,10 +172,12 @@ class AboutScreen extends StatelessWidget {
),
AdaptiveListTile(
margin: const EdgeInsets.symmetric(vertical: 4),
leading: const Icon(Icons.bug_report),
leading:
const ColorIcon(color: null, icon: Icons.bug_report),
title: Text(
S.of(context).Bug_Report,
style: subtitleTextStyle(context),
style: textStyle(context, bold: false)
.copyWith(fontSize: 16),
),
trailing: Icon(AdaptiveIcons.chevron_right),
onTap: () => launchUrl(
Expand All @@ -172,10 +187,12 @@ class AboutScreen extends StatelessWidget {
),
AdaptiveListTile(
margin: const EdgeInsets.symmetric(vertical: 4),
leading: const Icon(Icons.request_page),
leading: const ColorIcon(
color: null, icon: Icons.request_page),
title: Text(
S.of(context).Feature_Request,
style: subtitleTextStyle(context),
style: textStyle(context, bold: false)
.copyWith(fontSize: 16),
),
trailing: Icon(AdaptiveIcons.chevron_right),
onTap: () => launchUrl(
Expand Down
116 changes: 59 additions & 57 deletions lib/screens/settings_screen/playback/equalizer_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,49 +32,47 @@ class _EqualizerScreenState extends State<EqualizerScreen> {
body: SafeArea(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: LayoutBuilder(builder: (context, constraints) {
return SizedBox(
height: constraints.maxHeight > 600 ? 600 : null,
child: Column(
mainAxisSize: MainAxisSize.max,
children: [
AdaptiveListTile(
title: Text(S.of(context).Loudness_Enhancer),
trailing: AdaptiveSwitch(
value: settingsManager.loudnessEnabled,
onChanged: (value) async {
await GetIt.I<MediaPlayer>()
.setLoudnessEnabled(value);
},
),
onTap: () async {
await GetIt.I<MediaPlayer>().setLoudnessEnabled(
!settingsManager.loudnessEnabled);
child: SingleChildScrollView(
child: Column(
mainAxisSize: MainAxisSize.max,
children: [
AdaptiveListTile(
title: Text(S.of(context).Loudness_Enhancer),
trailing: AdaptiveSwitch(
value: settingsManager.loudnessEnabled,
onChanged: (value) async {
await GetIt.I<MediaPlayer>().setLoudnessEnabled(value);
},
),
LoudnessControls(
disabled: settingsManager.loudnessEnabled == false),
AdaptiveListTile(
title: Text(S.of(context).Enable_Equalizer),
trailing: AdaptiveSwitch(
value: settingsManager.equalizerEnabled,
onChanged: (value) async {
await GetIt.I<MediaPlayer>()
.setEqualizerEnabled(value);
},
),
onTap: () async {
await GetIt.I<MediaPlayer>().setEqualizerEnabled(
!settingsManager.equalizerEnabled);
onTap: () async {
await GetIt.I<MediaPlayer>()
.setLoudnessEnabled(!settingsManager.loudnessEnabled);
},
),
LoudnessControls(
disabled: settingsManager.loudnessEnabled == false),
AdaptiveListTile(
title: Text(S.of(context).Enable_Equalizer),
trailing: AdaptiveSwitch(
value: settingsManager.equalizerEnabled,
onChanged: (value) async {
await GetIt.I<MediaPlayer>().setEqualizerEnabled(value);
},
),
EqualizerControls(
onTap: () async {
await GetIt.I<MediaPlayer>().setEqualizerEnabled(
!settingsManager.equalizerEnabled);
},
),
SizedBox(
height: 400,
child: EqualizerControls(
disabled: !settingsManager.equalizerEnabled,
),
],
),
);
}),
),
],
),
),
),
),
),
Expand All @@ -96,28 +94,32 @@ class EqualizerControls extends StatelessWidget {
builder: (context, snapshot) {
final parameters = snapshot.data;
if (parameters == null) return const SizedBox();
return Expanded(
child: Row(
mainAxisSize: MainAxisSize.max,
children: [
for (var band in parameters['bands'])
Expanded(
child: Column(
children: [
Expanded(
child: VerticalSlider(
min: parameters['minDecibels'],
max: parameters['maxDecibels'],
value: band['gain'],
bandIndex: band['index'] as int,
disabled: disabled,
centerFrequency: band['centerFrequency'].round(),

return ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 400),
child: Expanded(
child: Row(
mainAxisSize: MainAxisSize.max,
children: [
for (var band in parameters['bands'])
Expanded(
child: Column(
children: [
Expanded(
child: VerticalSlider(
min: parameters['minDecibels'],
max: parameters['maxDecibels'],
value: band['gain'],
bandIndex: band['index'] as int,
disabled: disabled,
centerFrequency: band['centerFrequency'].round(),
),
),
),
],
],
),
),
),
],
],
),
),
);
},
Expand Down
8 changes: 3 additions & 5 deletions lib/screens/settings_screen/settings_screen.dart
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import 'dart:io';

import 'package:disable_battery_optimization/disable_battery_optimization.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:gyawun_beta/utils/adaptive_widgets/adaptive_widgets.dart';
import 'package:gyawun_beta/utils/bottom_modals.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:fluent_ui/fluent_ui.dart' as fluent_ui;

Expand Down Expand Up @@ -44,7 +44,7 @@ class _SettingsScreenState extends State<SettingsScreen> {

checkBatteryOptimisation() async {
isBatteryOptimisationDisabled =
await DisableBatteryOptimization.isBatteryOptimizationDisabled;
await Permission.ignoreBatteryOptimizations.isGranted;
setState(() {});
}

Expand Down Expand Up @@ -112,9 +112,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
style: tinyTextStyle(context),
),
onTap: () async {
await DisableBatteryOptimization
.showDisableBatteryOptimizationSettings();

await Permission.ignoreBatteryOptimizations.request();
await checkBatteryOptimisation();
},
),
Expand Down
8 changes: 0 additions & 8 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -217,14 +217,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "7.0.0"
disable_battery_optimization:
dependency: "direct main"
description:
name: disable_battery_optimization
sha256: "6b2ba802f984af141faf1b6b5fb956d5ef01f9cd555597c35b9cc335a03185ba"
url: "https://pub.dev"
source: hosted
version: "1.1.1"
duration_picker:
dependency: "direct main"
description:
Expand Down
1 change: 0 additions & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ dependencies:
flutter_acrylic: ^1.1.4
fluent_ui: ^4.9.0
window_manager: ^0.3.9
disable_battery_optimization: ^1.1.1
receive_sharing_intent: ^1.8.0
flutter_audio_output: ^0.0.2
fl_toast: ^3.2.0
Expand Down

0 comments on commit 2ec7cbf

Please sign in to comment.