🐛 Fix several known bugs

This commit is contained in:
2024-05-08 22:01:06 +08:00
parent a4f8c65aa5
commit c1d3bac0c8
27 changed files with 88 additions and 61 deletions

View File

@ -14,9 +14,8 @@ class AccountScreen extends StatelessWidget {
Widget build(BuildContext context) {
return IndentScaffold(
title: AppLocalizations.of(context)!.account,
noSafeArea: true,
fixedAppBarColor: SolianTheme.isLargeScreen(context),
child: AccountScreenWidget(
body: AccountScreenWidget(
onSelect: (item) {
SolianRouter.router.pushNamed(item);
},

View File

@ -18,9 +18,8 @@ class FriendScreen extends StatelessWidget {
Widget build(BuildContext context) {
return IndentScaffold(
title: AppLocalizations.of(context)!.friend,
noSafeArea: true,
hideDrawer: true,
child: const FriendScreenWidget(),
body: const FriendScreenWidget(),
);
}
}

View File

@ -22,7 +22,7 @@ class PersonalizeScreen extends StatelessWidget {
return IndentScaffold(
title: AppLocalizations.of(context)!.personalize,
hideDrawer: true,
child: const PersonalizeScreenWidget(),
body: const PersonalizeScreenWidget(),
);
}
}

View File

@ -64,7 +64,7 @@ class SignInScreen extends StatelessWidget {
return IndentScaffold(
title: AppLocalizations.of(context)!.signIn,
hideDrawer: true,
child: Center(
body: Center(
child: Container(
width: MediaQuery.of(context).size.width * 0.6,
constraints: const BoxConstraints(maxWidth: 360),

View File

@ -71,7 +71,7 @@ class SignUpScreen extends StatelessWidget {
return IndentScaffold(
title: AppLocalizations.of(context)!.signUp,
hideDrawer: true,
child: Center(
body: Center(
child: Container(
width: MediaQuery.of(context).size.width * 0.6,
constraints: const BoxConstraints(maxWidth: 360),

View File

@ -132,7 +132,7 @@ class _ChatCallState extends State<ChatCall> {
title: AppLocalizations.of(context)!.chatCall,
fixedAppBarColor: SolianTheme.isLargeScreen(context),
hideDrawer: true,
child: content,
body: content,
);
}

View File

@ -102,6 +102,7 @@ class _ChannelEditorScreenState extends State<ChannelEditorScreen> {
return IndentScaffold(
hideDrawer: true,
showSafeArea: true,
title: AppLocalizations.of(context)!.chatChannelOrganize,
appBarActions: <Widget>[
TextButton(
@ -109,7 +110,7 @@ class _ChannelEditorScreenState extends State<ChannelEditorScreen> {
child: Text(AppLocalizations.of(context)!.apply.toUpperCase()),
),
],
child: Column(
body: Column(
children: [
_isSubmitting ? const LinearProgressIndicator().animate().scaleX() : Container(),
widget.editing != null ? editingBanner : Container(),

View File

@ -38,6 +38,7 @@ class _ChatMemberScreenState extends State<ChatMemberScreen> {
_selfId = prof['id'];
var uri = getRequestUri('messaging', '/api/channels/${widget.realm}/${widget.channel.alias}/members');
print(uri);
var res = await auth.client!.get(uri);
if (res.statusCode == 200) {
@ -141,7 +142,6 @@ class _ChatMemberScreenState extends State<ChatMemberScreen> {
Widget build(BuildContext context) {
return IndentScaffold(
title: AppLocalizations.of(context)!.chatMember,
noSafeArea: true,
hideDrawer: true,
appBarActions: [
IconButton(
@ -149,7 +149,7 @@ class _ChatMemberScreenState extends State<ChatMemberScreen> {
onPressed: () => promptAddMember(),
),
],
child: RefreshIndicator(
body: RefreshIndicator(
onRefresh: () => fetchMemberships(),
child: CustomScrollView(
slivers: [

View File

@ -32,6 +32,7 @@ class ChatScreen extends StatelessWidget {
return IndentScaffold(
title: chat.focusChannel?.name ?? 'Loading...',
hideDrawer: true,
showSafeArea: true,
fixedAppBarColor: SolianTheme.isLargeScreen(context),
appBarActions: chat.focusChannel != null
? [
@ -48,7 +49,7 @@ class ChatScreen extends StatelessWidget {
),
]
: [],
child: ChatWidget(
body: ChatWidget(
alias: alias,
realm: realm,
),
@ -96,7 +97,7 @@ class _ChatWidgetState extends State<ChatWidget> {
if (a?.replyTo != null) return false;
if (a == null || b == null) return false;
if (a.senderId != b.senderId) return false;
return a.createdAt.difference(b.createdAt).inMinutes <= 5;
return a.createdAt.difference(b.createdAt).inMinutes <= 3;
}
Message? _editingItem;
@ -107,6 +108,7 @@ class _ChatWidgetState extends State<ChatWidget> {
context: context,
builder: (context) => ChatMessageAction(
channel: widget.alias,
realm: widget.realm,
item: item,
onEdit: () => setState(() {
_editingItem = item;

View File

@ -67,8 +67,7 @@ class _ChatDetailScreenState extends State<ChatDetailScreen> {
return IndentScaffold(
title: AppLocalizations.of(context)!.chatDetail,
hideDrawer: true,
noSafeArea: true,
child: Column(
body: Column(
children: [
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
@ -103,9 +102,12 @@ class _ChatDetailScreenState extends State<ChatDetailScreen> {
title: Text(AppLocalizations.of(context)!.chatMember),
onTap: () {
SolianRouter.router.pushNamed(
'chat.channel.member',
widget.realm == 'global' ? 'chat.channel.member' : 'realms.chat.channel.member',
extra: widget.channel,
pathParameters: {'channel': widget.channel.alias},
pathParameters: {
'channel': widget.channel.alias,
...(widget.realm == 'global' ? {} : {'realm': widget.realm}),
},
);
},
),

View File

@ -24,7 +24,7 @@ class ChatListScreen extends StatelessWidget {
title: AppLocalizations.of(context)!.chat,
appBarActions: const [NotificationButton()],
fixedAppBarColor: SolianTheme.isLargeScreen(context),
child: const ChatListWidget(),
body: const ChatListWidget(),
);
}
}

View File

@ -23,11 +23,10 @@ class ExplorePostScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return IndentScaffold(
noSafeArea: true,
fixedAppBarColor: SolianTheme.isLargeScreen(context),
appBarActions: const [NotificationButton()],
title: AppLocalizations.of(context)!.explore,
child: const ExplorePostWidget(showRealmShortcuts: true),
body: const ExplorePostWidget(showRealmShortcuts: true),
);
}
}

View File

@ -73,10 +73,9 @@ class _NotificationScreenState extends State<NotificationScreen> {
final nty = context.watch<NotifyProvider>();
return IndentScaffold(
noSafeArea: true,
hideDrawer: true,
title: AppLocalizations.of(context)!.notification,
child: RefreshIndicator(
body: RefreshIndicator(
onRefresh: () => nty.fetch(auth),
child: CustomScrollView(
slivers: [

View File

@ -122,6 +122,7 @@ class _CommentEditorScreenState extends State<CommentEditorScreen> {
return IndentScaffold(
hideDrawer: true,
showSafeArea: true,
title: AppLocalizations.of(context)!.newComment,
appBarActions: <Widget>[
TextButton(
@ -129,7 +130,7 @@ class _CommentEditorScreenState extends State<CommentEditorScreen> {
child: Text(AppLocalizations.of(context)!.postVerb.toUpperCase()),
),
],
child: Column(
body: Column(
children: [
_isSubmitting
? const LinearProgressIndicator().animate().scaleX()

View File

@ -55,6 +55,7 @@ class _MomentEditorScreenState extends State<MomentEditorScreen> {
final uri = widget.editing == null
? getRequestUri('interactive', '/api/p/moments')
: getRequestUri('interactive', '/api/p/moments/${widget.editing!.id}');
print(uri);
final req = Request(widget.editing == null ? 'POST' : 'PUT', uri);
req.headers['Content-Type'] = 'application/json';
@ -113,6 +114,7 @@ class _MomentEditorScreenState extends State<MomentEditorScreen> {
);
return IndentScaffold(
showSafeArea: true,
hideDrawer: true,
title: AppLocalizations.of(context)!.newMoment,
appBarActions: <Widget>[
@ -121,7 +123,7 @@ class _MomentEditorScreenState extends State<MomentEditorScreen> {
child: Text(AppLocalizations.of(context)!.postVerb.toUpperCase()),
),
],
child: Column(
body: Column(
children: [
_isSubmitting ? const LinearProgressIndicator().animate().scaleX() : Container(),
FutureBuilder(

View File

@ -21,9 +21,8 @@ class PostScreen extends StatelessWidget {
Widget build(BuildContext context) {
return IndentScaffold(
title: AppLocalizations.of(context)!.post,
noSafeArea: true,
hideDrawer: true,
child: PostScreenWidget(
body: PostScreenWidget(
dataset: dataset,
alias: alias,
),

View File

@ -21,7 +21,6 @@ class RealmScreen extends StatelessWidget {
return IndentScaffold(
title: realm.focusRealm?.name ?? 'Loading...',
noSafeArea: true,
hideDrawer: true,
fixedAppBarColor: SolianTheme.isLargeScreen(context),
appBarActions: realm.focusRealm != null
@ -32,17 +31,15 @@ class RealmScreen extends StatelessWidget {
),
]
: [],
appBarLeading: IconButton(
icon: const Icon(Icons.arrow_back),
onPressed: () {
if (SolianTheme.isLargeScreen(context)) {
realm.clearFocus();
} else if (SolianRouter.router.canPop()) {
SolianRouter.router.pop();
}
},
),
child: RealmWidget(
appBarLeading: SolianTheme.isLargeScreen(context)
? IconButton(
icon: const Icon(Icons.arrow_back),
onPressed: () {
realm.clearFocus();
},
)
: null,
body: RealmWidget(
alias: alias,
),
);

View File

@ -111,6 +111,7 @@ class _RealmEditorScreenState extends State<RealmEditorScreen> {
return IndentScaffold(
hideDrawer: true,
showSafeArea: true,
title: AppLocalizations.of(context)!.realmEstablish,
appBarActions: <Widget>[
TextButton(
@ -119,7 +120,7 @@ class _RealmEditorScreenState extends State<RealmEditorScreen> {
),
],
fixedAppBarColor: SolianTheme.isLargeScreen(context),
child: Column(
body: Column(
children: [
_isSubmitting ? const LinearProgressIndicator().animate().scaleX() : Container(),
widget.editing != null ? editingBanner : Container(),

View File

@ -23,7 +23,7 @@ class RealmListScreen extends StatelessWidget {
title: AppLocalizations.of(context)!.realm,
appBarActions: const [NotificationButton()],
fixedAppBarColor: SolianTheme.isLargeScreen(context),
child: const RealmListWidget(),
body: const RealmListWidget(),
)
: RealmScreen(alias: realm.focusRealm!.alias);
}

View File

@ -65,8 +65,7 @@ class _RealmManageScreenState extends State<RealmManageScreen> {
return IndentScaffold(
title: AppLocalizations.of(context)!.realmManage,
hideDrawer: true,
noSafeArea: true,
child: Column(
body: Column(
children: [
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),

View File

@ -142,7 +142,6 @@ class _RealmMemberScreenState extends State<RealmMemberScreen> {
return IndentScaffold(
title: AppLocalizations.of(context)!.realmMember,
fixedAppBarColor: SolianTheme.isLargeScreen(context),
noSafeArea: true,
hideDrawer: true,
appBarActions: [
IconButton(
@ -150,7 +149,7 @@ class _RealmMemberScreenState extends State<RealmMemberScreen> {
onPressed: () => promptAddMember(),
),
],
child: RefreshIndicator(
body: RefreshIndicator(
onRefresh: () => fetchMemberships(),
child: CustomScrollView(
slivers: [

View File

@ -65,8 +65,7 @@ class _UserInfoScreenState extends State<UserInfoScreen> {
title: _userinfo?.nick ?? 'Loading...',
fixedAppBarColor: SolianTheme.isLargeScreen(context),
hideDrawer: true,
noSafeArea: true,
child: FutureBuilder(
body: FutureBuilder(
future: fetchUserinfo(),
builder: (context, snapshot) {
if (!snapshot.hasData || snapshot.data == null) {