💄 Increase the appbar opacity when has background image
This commit is contained in:
parent
f3b7b02e77
commit
d3148ab89d
@ -78,6 +78,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||
if (image == null) return;
|
||||
|
||||
await File(image.path).copy('$_docBasepath/app_background_image');
|
||||
_prefs?.setBool('has_background_image', true);
|
||||
|
||||
setState(() {});
|
||||
},
|
||||
@ -98,6 +99,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||
trailing: const Icon(Symbols.chevron_right),
|
||||
onTap: () {
|
||||
File('$_docBasepath/app_background_image').deleteSync();
|
||||
_prefs?.remove('has_background_image');
|
||||
setState(() {});
|
||||
},
|
||||
);
|
||||
|
@ -1,4 +1,8 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
const kMaterialYouToggleStoreKey = 'app_theme_material_you';
|
||||
@ -28,9 +32,10 @@ Future<ThemeData> createAppTheme(
|
||||
brightness: brightness,
|
||||
);
|
||||
|
||||
final hasBackground = prefs.getBool('has_background_image') ?? false;
|
||||
|
||||
return ThemeData(
|
||||
useMaterial3:
|
||||
useMaterial3 ?? (prefs.getBool(kMaterialYouToggleStoreKey) ?? false),
|
||||
useMaterial3: useMaterial3 ?? (prefs.getBool(kMaterialYouToggleStoreKey) ?? false),
|
||||
colorScheme: colorScheme,
|
||||
brightness: brightness,
|
||||
iconTheme: IconThemeData(
|
||||
@ -41,6 +46,8 @@ Future<ThemeData> createAppTheme(
|
||||
),
|
||||
appBarTheme: AppBarTheme(
|
||||
centerTitle: true,
|
||||
backgroundColor: hasBackground ? colorScheme.primary.withOpacity(0.75) : colorScheme.primary,
|
||||
foregroundColor: colorScheme.onPrimary,
|
||||
),
|
||||
scaffoldBackgroundColor: Colors.transparent,
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user