💄 Optimzation and fixes

This commit is contained in:
2025-05-24 02:22:23 +08:00
parent fc2520b8f8
commit d11622e450
16 changed files with 277 additions and 148 deletions

View File

@ -9,9 +9,9 @@ import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:island/pods/userinfo.dart';
import 'package:island/pods/websocket.dart';
import 'package:island/route.dart';
import 'package:island/services/responsive.dart';
import 'package:material_symbols_icons/material_symbols_icons.dart';
import 'package:path_provider/path_provider.dart';
import 'package:responsive_framework/responsive_framework.dart';
import 'package:styled_widget/styled_widget.dart';
class WindowScaffold extends HookConsumerWidget {
@ -109,7 +109,7 @@ class AppScaffold extends StatelessWidget {
final AppBar? appBar;
final DrawerCallback? onDrawerChanged;
final DrawerCallback? onEndDrawerChanged;
final bool noBackground;
final bool? noBackground;
const AppScaffold({
super.key,
@ -124,7 +124,7 @@ class AppScaffold extends StatelessWidget {
this.endDrawer,
this.onDrawerChanged,
this.onEndDrawerChanged,
this.noBackground = false,
this.noBackground,
});
@override
@ -132,6 +132,8 @@ class AppScaffold extends StatelessWidget {
final appBarHeight = appBar?.preferredSize.height ?? 0;
final safeTop = MediaQuery.of(context).padding.top;
final noBackground = this.noBackground ?? isWideScreen(context);
final content = Column(
children: [
IgnorePointer(
@ -208,7 +210,7 @@ class AppBackground extends ConsumerWidget {
Widget build(BuildContext context, WidgetRef ref) {
final imageFileAsync = ref.watch(backgroundImageFileProvider);
if (isRoot || ResponsiveBreakpoints.of(context).smallerOrEqualTo(MOBILE)) {
if (isRoot || !isWideScreen(context)) {
return imageFileAsync.when(
data: (file) {
if (file != null) {
@ -254,6 +256,20 @@ class AppBackground extends ConsumerWidget {
}
}
class EmptyPageHolder extends HookConsumerWidget {
const EmptyPageHolder({super.key});
@override
Widget build(BuildContext context, WidgetRef ref) {
final hasBackground =
ref.watch(backgroundImageFileProvider).valueOrNull != null;
if (hasBackground) {
return const SizedBox.shrink();
}
return Container(color: Theme.of(context).scaffoldBackgroundColor);
}
}
class _WebSocketIndicator extends HookConsumerWidget {
const _WebSocketIndicator();