diff --git a/lib/router.dart b/lib/router.dart index d0ab996..b54e002 100644 --- a/lib/router.dart +++ b/lib/router.dart @@ -16,126 +16,124 @@ import 'package:surface/screens/settings.dart'; import 'package:surface/types/post.dart'; import 'package:surface/widgets/navigation/app_scaffold.dart'; +final _appRoutes = [ + ShellRoute( + builder: (context, state, child) => AppScaffold( + body: child, + showBottomNavigation: true, + showAppBar: false, + ), + routes: [ + GoRoute( + path: '/', + name: 'home', + builder: (context, state) => const HomeScreen(), + ), + GoRoute( + path: '/posts', + name: 'explore', + builder: (context, state) => const ExploreScreen(), + ), + GoRoute( + path: '/account', + name: 'account', + builder: (context, state) => const AccountScreen(), + ), + GoRoute( + path: '/chat', + name: 'chat', + builder: (context, state) => const ChatScreen(), + ), + GoRoute( + path: '/album', + name: 'album', + builder: (context, state) => const AlbumScreen(), + ), + ], + ), + ShellRoute( + builder: (context, state, child) => child, + routes: [ + GoRoute( + path: '/post/write/:mode', + name: 'postEditor', + builder: (context, state) => PostEditorScreen( + mode: state.pathParameters['mode']!, + postEditId: int.tryParse( + state.uri.queryParameters['editing'] ?? '', + ), + postReplyId: int.tryParse( + state.uri.queryParameters['replying'] ?? '', + ), + postRepostId: int.tryParse( + state.uri.queryParameters['reposting'] ?? '', + ), + ), + ), + GoRoute( + path: '/post/:slug', + name: 'postDetail', + builder: (context, state) => PostDetailScreen( + slug: state.pathParameters['slug']!, + preload: state.extra as SnPost?, + ), + ) + ], + ), + ShellRoute( + builder: (context, state, child) => AppScaffold(body: child), + routes: [ + GoRoute( + path: '/auth/login', + name: 'authLogin', + builder: (context, state) => const LoginScreen(), + ), + GoRoute( + path: '/auth/register', + name: 'authRegister', + builder: (context, state) => const RegisterScreen(), + ), + GoRoute( + path: '/account/profile/edit', + name: 'accountProfileEdit', + builder: (context, state) => const ProfileEditScreen(), + ), + GoRoute( + path: '/account/publishers', + name: 'accountPublishers', + builder: (context, state) => const PublisherScreen(), + ), + GoRoute( + path: '/account/publishers/new', + name: 'accountPublisherNew', + builder: (context, state) => const AccountPublisherNewScreen(), + ), + GoRoute( + path: '/account/publishers/edit/:name', + name: 'accountPublisherEdit', + builder: (context, state) => AccountPublisherEditScreen( + name: state.pathParameters['name']!, + ), + ), + ], + ), + ShellRoute( + builder: (context, state, child) => AppScaffold(body: child), + routes: [ + GoRoute( + path: '/settings', + name: 'settings', + builder: (context, state) => const SettingsScreen(), + ), + ], + ), +]; + final appRouter = GoRouter( routes: [ ShellRoute( - builder: (context, state, child) => AppScaffold( - body: child, - showBottomNavigation: true, - showDrawer: true, - ), - routes: [ - GoRoute( - path: '/', - name: 'home', - builder: (context, state) => const HomeScreen(), - ), - GoRoute( - path: '/posts', - name: 'explore', - builder: (context, state) => const ExploreScreen(), - ), - GoRoute( - path: '/account', - name: 'account', - builder: (context, state) => const AccountScreen(), - ), - GoRoute( - path: '/chat', - name: 'chat', - builder: (context, state) => const ChatScreen(), - ), - GoRoute( - path: '/album', - name: 'album', - builder: (context, state) => const AlbumScreen(), - ), - ], - ), - ShellRoute( - builder: (context, state, child) => AppScaffold( - body: child, - ), - routes: [ - GoRoute( - path: '/post/write/:mode', - name: 'postEditor', - builder: (context, state) => PostEditorScreen( - mode: state.pathParameters['mode']!, - postEditId: int.tryParse( - state.uri.queryParameters['editing'] ?? '', - ), - postReplyId: int.tryParse( - state.uri.queryParameters['replying'] ?? '', - ), - postRepostId: int.tryParse( - state.uri.queryParameters['reposting'] ?? '', - ), - ), - ), - GoRoute( - path: '/post/:slug', - name: 'postDetail', - builder: (context, state) => PostDetailScreen( - slug: state.pathParameters['slug']!, - preload: state.extra as SnPost?, - ), - ) - ], - ), - ShellRoute( - builder: (context, state, child) => AppScaffold( - body: child, - autoImplyAppBar: true, - showDrawer: true, - ), - routes: [ - GoRoute( - path: '/auth/login', - name: 'authLogin', - builder: (context, state) => const LoginScreen(), - ), - GoRoute( - path: '/auth/register', - name: 'authRegister', - builder: (context, state) => const RegisterScreen(), - ), - GoRoute( - path: '/account/profile/edit', - name: 'accountProfileEdit', - builder: (context, state) => const ProfileEditScreen(), - ), - GoRoute( - path: '/account/publishers', - name: 'accountPublishers', - builder: (context, state) => const PublisherScreen(), - ), - GoRoute( - path: '/account/publishers/new', - name: 'accountPublisherNew', - builder: (context, state) => const AccountPublisherNewScreen(), - ), - GoRoute( - path: '/account/publishers/edit/:name', - name: 'accountPublisherEdit', - builder: (context, state) => AccountPublisherEditScreen( - name: state.pathParameters['name']!, - ), - ), - ], - ), - ShellRoute( - builder: (context, state, child) => AppScaffold( - body: child, - autoImplyAppBar: true, - ), - routes: [ - GoRoute( - path: '/settings', - name: 'settings', - builder: (context, state) => const SettingsScreen(), - ), - ], + builder: (context, state, child) => AppRootScaffold(body: child), + routes: _appRoutes, ), ], ); diff --git a/lib/screens/account.dart b/lib/screens/account.dart index 29efea4..d0f60ad 100644 --- a/lib/screens/account.dart +++ b/lib/screens/account.dart @@ -8,7 +8,6 @@ import 'package:styled_widget/styled_widget.dart'; import 'package:surface/providers/userinfo.dart'; import 'package:surface/widgets/account/account_image.dart'; import 'package:surface/widgets/dialog.dart'; -import 'package:surface/widgets/navigation/app_scaffold.dart'; class AccountScreen extends StatelessWidget { const AccountScreen({super.key}); @@ -17,7 +16,7 @@ class AccountScreen extends StatelessWidget { Widget build(BuildContext context) { final ua = context.watch(); - return AppScaffold( + return Scaffold( appBar: AppBar( title: Text("screenAccount").tr(), actions: [ diff --git a/lib/screens/account/publishers/publisher_edit.dart b/lib/screens/account/publishers/publisher_edit.dart index 5233c9b..fe7a215 100644 --- a/lib/screens/account/publishers/publisher_edit.dart +++ b/lib/screens/account/publishers/publisher_edit.dart @@ -18,7 +18,6 @@ import 'package:surface/types/post.dart'; import 'package:surface/widgets/account/account_image.dart'; import 'package:surface/widgets/dialog.dart'; import 'package:surface/widgets/loading_indicator.dart'; -import 'package:surface/widgets/navigation/app_scaffold.dart'; import 'package:surface/widgets/universal_image.dart'; class AccountPublisherEditScreen extends StatefulWidget { @@ -189,7 +188,7 @@ class _AccountPublisherEditScreenState Widget build(BuildContext context) { final sn = context.read(); - return AppScaffold( + return Scaffold( body: SingleChildScrollView( child: Column( children: [ diff --git a/lib/screens/account/publishers/publisher_new.dart b/lib/screens/account/publishers/publisher_new.dart index a5d1339..98b34ab 100644 --- a/lib/screens/account/publishers/publisher_new.dart +++ b/lib/screens/account/publishers/publisher_new.dart @@ -8,7 +8,6 @@ import 'package:surface/providers/sn_network.dart'; import 'package:surface/providers/userinfo.dart'; import 'package:surface/widgets/account/account_image.dart'; import 'package:surface/widgets/dialog.dart'; -import 'package:surface/widgets/navigation/app_scaffold.dart'; class AccountPublisherNewScreen extends StatefulWidget { const AccountPublisherNewScreen({super.key}); @@ -23,7 +22,7 @@ class _AccountPublisherNewScreenState extends State { @override Widget build(BuildContext context) { - return AppScaffold( + return Scaffold( body: SingleChildScrollView( child: Column( children: [ diff --git a/lib/screens/account/publishers/publishers.dart b/lib/screens/account/publishers/publishers.dart index 495448d..5479996 100644 --- a/lib/screens/account/publishers/publishers.dart +++ b/lib/screens/account/publishers/publishers.dart @@ -1,5 +1,4 @@ import 'package:easy_localization/easy_localization.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:gap/gap.dart'; import 'package:go_router/go_router.dart'; @@ -11,7 +10,6 @@ import 'package:surface/types/post.dart'; import 'package:surface/widgets/account/account_image.dart'; import 'package:surface/widgets/dialog.dart'; import 'package:surface/widgets/loading_indicator.dart'; -import 'package:surface/widgets/navigation/app_scaffold.dart'; class PublisherScreen extends StatefulWidget { const PublisherScreen({super.key}); @@ -55,7 +53,7 @@ class _PublisherScreenState extends State { @override Widget build(BuildContext context) { - return AppScaffold( + return Scaffold( body: Column( children: [ ListTile( diff --git a/lib/screens/explore.dart b/lib/screens/explore.dart index a452fad..a8ed730 100644 --- a/lib/screens/explore.dart +++ b/lib/screens/explore.dart @@ -8,7 +8,6 @@ import 'package:provider/provider.dart'; import 'package:surface/providers/sn_attachment.dart'; import 'package:surface/providers/sn_network.dart'; import 'package:surface/types/post.dart'; -import 'package:surface/widgets/navigation/app_scaffold.dart'; import 'package:surface/widgets/post/post_item.dart'; import 'package:very_good_infinite_list/very_good_infinite_list.dart'; @@ -74,7 +73,7 @@ class _ExploreScreenState extends State { @override Widget build(BuildContext context) { - return AppScaffold( + return Scaffold( floatingActionButtonLocation: ExpandableFab.location, floatingActionButton: ExpandableFab( key: _fabKey, diff --git a/lib/screens/home.dart b/lib/screens/home.dart index 88df570..9b34022 100644 --- a/lib/screens/home.dart +++ b/lib/screens/home.dart @@ -1,7 +1,6 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:material_symbols_icons/symbols.dart'; import 'package:styled_widget/styled_widget.dart'; -import 'package:surface/widgets/navigation/app_scaffold.dart'; import 'package:flutter/material.dart'; class HomeScreen extends StatefulWidget { @@ -14,7 +13,7 @@ class HomeScreen extends StatefulWidget { class _HomeScreenState extends State { @override Widget build(BuildContext context) { - return AppScaffold( + return Scaffold( appBar: AppBar( title: Text("screenHome").tr(), ), diff --git a/lib/screens/post/post_detail.dart b/lib/screens/post/post_detail.dart index 49ca251..e3b3688 100644 --- a/lib/screens/post/post_detail.dart +++ b/lib/screens/post/post_detail.dart @@ -12,7 +12,6 @@ import 'package:surface/providers/sn_network.dart'; import 'package:surface/types/post.dart'; import 'package:surface/widgets/dialog.dart'; import 'package:surface/widgets/loading_indicator.dart'; -import 'package:surface/widgets/navigation/app_scaffold.dart'; import 'package:surface/widgets/post/post_comment_list.dart'; import 'package:surface/widgets/post/post_item.dart'; import 'package:surface/widgets/post/post_mini_editor.dart'; @@ -74,7 +73,7 @@ class _PostDetailScreenState extends State { Widget build(BuildContext context) { final devicePixelRatio = MediaQuery.of(context).devicePixelRatio; - return AppScaffold( + return Scaffold( appBar: AppBar( leading: BackButton( onPressed: () { diff --git a/lib/screens/post/post_editor.dart b/lib/screens/post/post_editor.dart index 0450b36..3511723 100644 --- a/lib/screens/post/post_editor.dart +++ b/lib/screens/post/post_editor.dart @@ -15,7 +15,6 @@ import 'package:surface/providers/sn_network.dart'; import 'package:surface/types/post.dart'; import 'package:surface/widgets/account/account_image.dart'; import 'package:surface/widgets/loading_indicator.dart'; -import 'package:surface/widgets/navigation/app_scaffold.dart'; import 'package:surface/widgets/post/post_item.dart'; import 'package:surface/widgets/post/post_media_pending_list.dart'; import 'package:surface/widgets/post/post_meta_editor.dart'; @@ -111,7 +110,7 @@ class _PostEditorScreenState extends State { return ListenableBuilder( listenable: _writeController, builder: (context, _) { - return AppScaffold( + return Scaffold( appBar: AppBar( leading: BackButton( onPressed: () { diff --git a/lib/screens/settings.dart b/lib/screens/settings.dart index 93d568f..afb4e9e 100644 --- a/lib/screens/settings.dart +++ b/lib/screens/settings.dart @@ -15,7 +15,6 @@ import 'package:surface/providers/sn_network.dart'; import 'package:surface/providers/theme.dart'; import 'package:surface/theme.dart'; import 'package:surface/widgets/dialog.dart'; -import 'package:surface/widgets/navigation/app_scaffold.dart'; class SettingsScreen extends StatefulWidget { const SettingsScreen({super.key}); @@ -58,7 +57,7 @@ class _SettingsScreenState extends State { Widget build(BuildContext context) { final sn = context.read(); - return AppScaffold( + return Scaffold( body: SingleChildScrollView( child: Column( crossAxisAlignment: CrossAxisAlignment.start, diff --git a/lib/widgets/attachment/attachment_list.dart b/lib/widgets/attachment/attachment_list.dart index 1bb95dd..f5d61c5 100644 --- a/lib/widgets/attachment/attachment_list.dart +++ b/lib/widgets/attachment/attachment_list.dart @@ -1,5 +1,3 @@ -import 'dart:math' as math; - import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:gap/gap.dart'; @@ -11,14 +9,15 @@ class AttachmentList extends StatelessWidget { final List data; final bool? bordered; final double? maxHeight; + final EdgeInsets? listPadding; const AttachmentList({ super.key, required this.data, this.bordered, this.maxHeight, + this.listPadding, }); - static const double kMaxItemWidth = 520; static const BorderRadius kDefaultRadius = BorderRadius.all(Radius.circular(8)); @@ -31,23 +30,24 @@ class AttachmentList extends StatelessWidget { if (data.isEmpty) return const SizedBox.shrink(); if (data.length == 1) { if (ResponsiveBreakpoints.of(context).largerThan(MOBILE)) { - return Container( - constraints: BoxConstraints( - maxHeight: maxHeight ?? double.infinity, - maxWidth: math.min( - MediaQuery.of(context).size.width - 20, - kMaxItemWidth, + return Padding( + // Single child list-like displaying + padding: listPadding ?? EdgeInsets.zero, + child: Container( + constraints: BoxConstraints( + minWidth: 80, + maxHeight: maxHeight ?? double.infinity, ), - ), - decoration: BoxDecoration( - border: Border(top: borderSide, bottom: borderSide), - borderRadius: kDefaultRadius, - ), - child: AspectRatio( - aspectRatio: data[0].metadata['ratio']?.toDouble() ?? 1, - child: ClipRRect( + decoration: BoxDecoration( + border: Border(top: borderSide, bottom: borderSide), borderRadius: kDefaultRadius, - child: AttachmentItem(data: data[0], isExpandable: true), + ), + child: AspectRatio( + aspectRatio: data[0].metadata['ratio']?.toDouble() ?? 1, + child: ClipRRect( + borderRadius: kDefaultRadius, + child: AttachmentItem(data: data[0], isExpandable: true), + ), ), ), ); @@ -74,11 +74,8 @@ class AttachmentList extends StatelessWidget { itemBuilder: (context, idx) { return Container( constraints: BoxConstraints( + minWidth: 80, maxHeight: maxHeight ?? double.infinity, - maxWidth: math.min( - MediaQuery.of(context).size.width - 20, - kMaxItemWidth, - ), ), decoration: BoxDecoration( border: Border(top: borderSide, bottom: borderSide), @@ -94,7 +91,7 @@ class AttachmentList extends StatelessWidget { ); }, separatorBuilder: (context, index) => const Gap(8), - padding: const EdgeInsets.symmetric(horizontal: 12), + padding: listPadding, physics: const BouncingScrollPhysics(), scrollDirection: Axis.horizontal, ), diff --git a/lib/widgets/navigation/app_drawer_navigation.dart b/lib/widgets/navigation/app_drawer_navigation.dart index 4d3edb4..c5aeca5 100644 --- a/lib/widgets/navigation/app_drawer_navigation.dart +++ b/lib/widgets/navigation/app_drawer_navigation.dart @@ -1,5 +1,3 @@ -import 'dart:math' as math; - import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:go_router/go_router.dart'; @@ -9,7 +7,8 @@ import 'package:styled_widget/styled_widget.dart'; import 'package:surface/providers/navigation.dart'; class AppNavigationDrawer extends StatefulWidget { - const AppNavigationDrawer({super.key}); + final double? elevation; + const AppNavigationDrawer({super.key, this.elevation}); @override State createState() => _AppNavigationDrawerState(); @@ -43,6 +42,7 @@ class _AppNavigationDrawerState extends State { ]; return NavigationDrawer( + elevation: widget.elevation, backgroundColor: backgroundColor, selectedIndex: nav.currentIndex, children: [ @@ -56,7 +56,7 @@ class _AppNavigationDrawerState extends State { ], ).padding( horizontal: 32, - top: math.max(MediaQuery.of(context).padding.top, 16), + top: MediaQuery.of(context).padding.top > 16 ? 0 : 16, bottom: 16, ), ...destinations.where((ele) => ele.isPinned).map((ele) { diff --git a/lib/widgets/navigation/app_rail_navigation.dart b/lib/widgets/navigation/app_rail_navigation.dart new file mode 100644 index 0000000..b5376a6 --- /dev/null +++ b/lib/widgets/navigation/app_rail_navigation.dart @@ -0,0 +1,68 @@ +import 'package:easy_localization/easy_localization.dart'; +import 'package:flutter/material.dart'; +import 'package:go_router/go_router.dart'; +import 'package:material_symbols_icons/symbols.dart'; +import 'package:provider/provider.dart'; +import 'package:styled_widget/styled_widget.dart'; +import 'package:surface/providers/navigation.dart'; + +class AppRailNavigation extends StatefulWidget { + const AppRailNavigation({super.key}); + + @override + State createState() => _AppRailNavigationState(); +} + +class _AppRailNavigationState extends State { + @override + void initState() { + super.initState(); + WidgetsBinding.instance.addPostFrameCallback((_) { + context + .read() + .autoDetectIndex(GoRouter.maybeOf(context)); + }); + } + + @override + Widget build(BuildContext context) { + final nav = context.watch(); + + return ListenableBuilder( + listenable: nav, + builder: (context, _) { + final destinations = + nav.destinations.where((ele) => ele.isPinned).toList(); + + return NavigationRail( + selectedIndex: nav.currentIndex, + destinations: [ + ...destinations.where((ele) => ele.isPinned).map((ele) { + return NavigationRailDestination( + icon: ele.icon, + label: Text(ele.label).tr(), + ); + }), + ], + trailing: Expanded( + child: Align( + alignment: Alignment.bottomCenter, + child: StyledWidget( + IconButton( + icon: const Icon(Symbols.menu), + onPressed: () { + Scaffold.of(context).openDrawer(); + }, + ), + ).padding(bottom: 16), + ), + ), + onDestinationSelected: (idx) { + nav.setIndex(idx); + GoRouter.of(context).goNamed(destinations[idx].screen); + }, + ); + }, + ); + } +} diff --git a/lib/widgets/navigation/app_scaffold.dart b/lib/widgets/navigation/app_scaffold.dart index a348081..1e93c0c 100644 --- a/lib/widgets/navigation/app_scaffold.dart +++ b/lib/widgets/navigation/app_scaffold.dart @@ -6,77 +6,83 @@ import 'package:surface/widgets/dialog.dart'; import 'package:surface/widgets/navigation/app_background.dart'; import 'package:surface/widgets/navigation/app_bottom_navigation.dart'; import 'package:surface/widgets/navigation/app_drawer_navigation.dart'; +import 'package:surface/widgets/navigation/app_rail_navigation.dart'; class AppScaffold extends StatelessWidget { - final PreferredSizeWidget? appBar; - final FloatingActionButtonLocation? floatingActionButtonLocation; - final Widget? floatingActionButton; final String? title; final Widget? body; - final bool autoImplyAppBar; + final bool showAppBar; final bool showBottomNavigation; - final bool showDrawer; const AppScaffold({ super.key, - this.appBar, - this.floatingActionButton, - this.floatingActionButtonLocation, this.title, this.body, - this.autoImplyAppBar = false, + this.showAppBar = true, this.showBottomNavigation = false, - this.showDrawer = false, }); @override Widget build(BuildContext context) { - final isShowDrawer = showDrawer - ? ResponsiveBreakpoints.of(context).smallerOrEqualTo(MOBILE) - : false; final isShowBottomNavigation = (showBottomNavigation) ? ResponsiveBreakpoints.of(context).smallerOrEqualTo(MOBILE) : false; final state = GoRouter.maybeOf(context); + final autoTitle = state != null + ? 'screen${state.routerDelegate.currentConfiguration.last.route.name?.capitalize()}' + : 'screen'; - final innerWidget = AppBackground( - child: Scaffold( - appBar: appBar ?? - (autoImplyAppBar - ? AppBar( - title: title != null - ? Text(title!) - : state != null - ? Text( - ('screen${state.routerDelegate.currentConfiguration.last.route.name?.capitalize()}') - .tr(), - ) - : null) - : null), - body: body, - floatingActionButtonLocation: floatingActionButtonLocation, - floatingActionButton: floatingActionButton, - drawer: isShowDrawer ? AppNavigationDrawer() : null, - bottomNavigationBar: - isShowBottomNavigation ? AppBottomNavigationBar() : null, - ), + return Scaffold( + appBar: showAppBar + ? AppBar( + title: Text(title ?? autoTitle.tr()), + ) + : null, + body: body, + bottomNavigationBar: + isShowBottomNavigation ? AppBottomNavigationBar() : null, + ); + } +} + +class AppRootScaffold extends StatelessWidget { + final Widget body; + const AppRootScaffold({super.key, required this.body}); + + @override + Widget build(BuildContext context) { + final devicePixelRatio = MediaQuery.of(context).devicePixelRatio; + + final isCollapseDrawer = + ResponsiveBreakpoints.of(context).smallerOrEqualTo(MOBILE); + final isExpandDrawer = ResponsiveBreakpoints.of(context).largerThan(TABLET); + + final innerWidget = isCollapseDrawer + ? body + : Row( + children: [ + Container( + decoration: BoxDecoration( + border: Border( + right: BorderSide( + color: Theme.of(context).dividerColor, + width: 1 / devicePixelRatio, + ), + ), + ), + child: isExpandDrawer + ? AppNavigationDrawer(elevation: 0) + : AppRailNavigation(), + ), + Expanded(child: body), + ], + ); + + return AppBackground( + child: Scaffold( + body: innerWidget, + drawer: !isExpandDrawer ? AppNavigationDrawer() : null, + ), ); - - if (showDrawer && ResponsiveBreakpoints.of(context).largerThan(MOBILE)) { - final devicePixelRatio = MediaQuery.of(context).devicePixelRatio; - - return Row( - children: [ - AppNavigationDrawer(), - VerticalDivider( - width: 1 / devicePixelRatio, - thickness: 1 / devicePixelRatio, - ), - Expanded(child: innerWidget), - ], - ); - } - - return innerWidget; } } diff --git a/lib/widgets/post/post_item.dart b/lib/widgets/post/post_item.dart index 8271807..1f2800e 100644 --- a/lib/widgets/post/post_item.dart +++ b/lib/widgets/post/post_item.dart @@ -4,7 +4,6 @@ import 'package:go_router/go_router.dart'; import 'package:material_symbols_icons/symbols.dart'; import 'package:provider/provider.dart'; import 'package:relative_time/relative_time.dart'; -import 'package:responsive_framework/responsive_framework.dart'; import 'package:styled_widget/styled_widget.dart'; import 'package:surface/providers/userinfo.dart'; import 'package:surface/types/post.dart'; @@ -34,10 +33,6 @@ class PostItem extends StatelessWidget { @override Widget build(BuildContext context) { - final isListAttachments = - ResponsiveBreakpoints.of(context).largerThan(MOBILE) || - (data.preload?.attachments?.length ?? 0) > 1; - return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -52,7 +47,8 @@ class PostItem extends StatelessWidget { data: data.preload!.attachments!, bordered: true, maxHeight: 520, - ).padding(horizontal: isListAttachments ? 12 : 0), + listPadding: const EdgeInsets.symmetric(horizontal: 12), + ), _PostBottomAction( data: data, showComments: showComments,