💄 Finishing up refactor background image related changes

This commit is contained in:
LittleSheep 2025-01-21 20:50:07 +08:00
parent c82dc7ad85
commit 127d9adc09
8 changed files with 266 additions and 276 deletions

View File

@ -282,7 +282,7 @@ final _appRoutes = [
),
),
ShellRoute(
builder: (context, state, child) => AppPageScaffold(body: child),
builder: (context, state, child) => child,
routes: [
GoRoute(
path: '/settings',
@ -292,7 +292,7 @@ final _appRoutes = [
],
),
ShellRoute(
builder: (context, state, child) => AppPageScaffold(body: child),
builder: (context, state, child) => child,
routes: [
GoRoute(
path: '/about',

View File

@ -210,7 +210,7 @@ class _ProfileEditScreenState extends State<ProfileEditScreen> {
return AppScaffold(
appBar: AppBar(
leading: const PageBackButton(),
title: Text('screenProfileEdit').tr(),
title: Text('screenAccountProfileEdit').tr(),
),
body: SingleChildScrollView(
child: Column(

View File

@ -234,6 +234,9 @@ class _FriendScreenState extends State<FriendScreen> {
if (_requests.isNotEmpty || _blocks.isNotEmpty)
const Divider(height: 1),
Expanded(
child: MediaQuery.removePadding(
context: context,
removeTop: true,
child: RefreshIndicator(
onRefresh: () => Future.wait([
_fetchRelations(),
@ -283,6 +286,7 @@ class _FriendScreenState extends State<FriendScreen> {
),
),
),
),
],
),
);

View File

@ -119,6 +119,9 @@ class _RealmScreenState extends State<RealmScreen> {
children: [
LoadingIndicator(isActive: _isBusy),
Expanded(
child: MediaQuery.removePadding(
context: context,
removeTop: true,
child: RefreshIndicator(
onRefresh: _fetchRealms,
child: ListView.builder(
@ -197,7 +200,9 @@ class _RealmScreenState extends State<RealmScreen> {
clipBehavior: Clip.none,
fit: StackFit.expand,
children: [
Container(
ClipRRect(
borderRadius: const BorderRadius.all(Radius.circular(8)),
child: Container(
color: Theme.of(context).colorScheme.surfaceContainer,
child: (realm.banner?.isEmpty ?? true)
? const SizedBox.shrink()
@ -206,6 +211,7 @@ class _RealmScreenState extends State<RealmScreen> {
fit: BoxFit.cover,
),
),
),
Positioned(
bottom: -30,
left: 18,
@ -241,6 +247,7 @@ class _RealmScreenState extends State<RealmScreen> {
),
),
),
),
],
),
);

View File

@ -8,14 +8,13 @@ import 'package:styled_widget/styled_widget.dart';
import 'package:surface/providers/sn_network.dart';
import 'package:surface/providers/user_directory.dart';
import 'package:surface/providers/userinfo.dart';
import 'package:surface/types/post.dart';
import 'package:surface/types/realm.dart';
import 'package:surface/widgets/account/account_image.dart';
import 'package:surface/widgets/dialog.dart';
import 'package:surface/widgets/navigation/app_scaffold.dart';
import 'package:very_good_infinite_list/very_good_infinite_list.dart';
import '../../types/post.dart';
class RealmDetailScreen extends StatefulWidget {
final String alias;
@ -421,7 +420,7 @@ class _RealmSettingsWidgetState extends State<_RealmSettingsWidget> {
return Column(
children: [
const Gap(16),
const Gap(8),
ListTile(
leading: const Icon(Symbols.edit),
trailing: const Icon(Symbols.chevron_right),

View File

@ -68,8 +68,11 @@ class _SettingsScreenState extends State<SettingsScreen> {
Widget build(BuildContext context) {
final sn = context.read<SnNetworkProvider>();
return Scaffold(
backgroundColor: Colors.transparent,
return AppScaffold(
appBar: AppBar(
leading: const PageBackButton(),
title: Text('screenSettings').tr(),
),
body: SingleChildScrollView(
child: Column(
spacing: 16,

View File

@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
import 'package:gap/gap.dart';
import 'package:package_info_plus/package_info_plus.dart';
import 'package:styled_widget/styled_widget.dart';
import 'package:surface/widgets/navigation/app_scaffold.dart';
import 'package:url_launcher/url_launcher_string.dart';
class AboutScreen extends StatelessWidget {
@ -12,7 +13,12 @@ class AboutScreen extends StatelessWidget {
Widget build(BuildContext context) {
const denseButtonStyle = ButtonStyle(visualDensity: VisualDensity(vertical: -4));
return SizedBox(
return AppScaffold(
appBar: AppBar(
leading: const PageBackButton(),
title: Text('screenAbout').tr(),
),
body: SizedBox(
width: double.infinity,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
@ -104,6 +110,7 @@ class AboutScreen extends StatelessWidget {
),
],
),
),
);
}
}

View File

@ -95,36 +95,6 @@ class PageBackButton extends StatelessWidget {
}
}
class AppPageScaffold extends StatelessWidget {
final String? title;
final Widget? body;
final bool showAppBar;
const AppPageScaffold({
super.key,
this.title,
this.body,
this.showAppBar = true,
});
@override
Widget build(BuildContext context) {
final state = GoRouter.maybeOf(context);
final routeName = state?.routerDelegate.currentConfiguration.last.route.name;
final autoTitle = state != null ? 'screen${routeName?.capitalize()}' : 'screen';
return AppScaffold(
appBar: showAppBar
? AppBar(
title: Text(title ?? autoTitle.tr()),
)
: null,
body: body,
);
}
}
class AppRootScaffold extends StatelessWidget {
final Widget body;