💄 Better post quick reply
This commit is contained in:
@@ -490,14 +490,13 @@ class PostDetailScreen extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
if (user.value != null)
|
if (user.value != null)
|
||||||
Positioned(
|
Positioned(
|
||||||
bottom: 0,
|
bottom: 16 + MediaQuery.of(context).padding.bottom,
|
||||||
left: 0,
|
left: 16,
|
||||||
right: 0,
|
right: 16,
|
||||||
child: Material(
|
child:
|
||||||
elevation: 2,
|
ConstrainedBox(
|
||||||
color: Theme.of(context).colorScheme.surfaceContainer,
|
constraints: BoxConstraints(maxWidth: 660),
|
||||||
child: postState
|
child: postState.when(
|
||||||
.when(
|
|
||||||
data:
|
data:
|
||||||
(post) => PostQuickReply(
|
(post) => PostQuickReply(
|
||||||
parent: post!,
|
parent: post!,
|
||||||
@@ -509,13 +508,8 @@ class PostDetailScreen extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
loading: () => const SizedBox.shrink(),
|
loading: () => const SizedBox.shrink(),
|
||||||
error: (_, _) => const SizedBox.shrink(),
|
error: (_, _) => const SizedBox.shrink(),
|
||||||
)
|
|
||||||
.padding(
|
|
||||||
bottom: MediaQuery.of(context).padding.bottom + 8,
|
|
||||||
top: 8,
|
|
||||||
horizontal: 16,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
|
).center(),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
import 'package:easy_localization/easy_localization.dart';
|
import 'package:easy_localization/easy_localization.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||||
|
import 'package:gap/gap.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
import 'package:island/models/post.dart';
|
import 'package:island/models/post.dart';
|
||||||
@@ -69,8 +70,14 @@ class PostQuickReply extends HookConsumerWidget {
|
|||||||
|
|
||||||
return publishers.when(
|
return publishers.when(
|
||||||
data:
|
data:
|
||||||
(data) => Row(
|
(data) => Material(
|
||||||
spacing: 8,
|
elevation: 2,
|
||||||
|
color: Theme.of(context).colorScheme.surfaceContainerHighest,
|
||||||
|
borderRadius: BorderRadius.circular(20),
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: 6, horizontal: 8),
|
||||||
|
child: Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
child: ProfilePictureWidget(
|
child: ProfilePictureWidget(
|
||||||
@@ -83,10 +90,12 @@ class PostQuickReply extends HookConsumerWidget {
|
|||||||
context: context,
|
context: context,
|
||||||
builder: (context) => PublisherModal(),
|
builder: (context) => PublisherModal(),
|
||||||
).then((value) {
|
).then((value) {
|
||||||
if (value is SnPublisher) currentPublisher.value = value;
|
if (value is SnPublisher) {
|
||||||
|
currentPublisher.value = value;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
).padding(right: 4),
|
).padding(right: 12),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: TextField(
|
child: TextField(
|
||||||
controller: contentController,
|
controller: contentController,
|
||||||
@@ -97,7 +106,7 @@ class PostQuickReply extends HookConsumerWidget {
|
|||||||
isCollapsed: true,
|
isCollapsed: true,
|
||||||
contentPadding: EdgeInsets.symmetric(
|
contentPadding: EdgeInsets.symmetric(
|
||||||
horizontal: 12,
|
horizontal: 12,
|
||||||
vertical: 8,
|
vertical: 9,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
style: TextStyle(fontSize: 14),
|
style: TextStyle(fontSize: 14),
|
||||||
@@ -106,6 +115,7 @@ class PostQuickReply extends HookConsumerWidget {
|
|||||||
(_) => FocusManager.instance.primaryFocus?.unfocus(),
|
(_) => FocusManager.instance.primaryFocus?.unfocus(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
const Gap(8),
|
||||||
IconButton(
|
IconButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
onLaunch?.call();
|
onLaunch?.call();
|
||||||
@@ -122,13 +132,9 @@ class PostQuickReply extends HookConsumerWidget {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
icon: const Icon(Symbols.launch, size: 20),
|
icon: const Icon(Symbols.launch, size: 20),
|
||||||
padding: EdgeInsets.zero,
|
|
||||||
visualDensity: VisualDensity.compact,
|
visualDensity: VisualDensity.compact,
|
||||||
constraints: const BoxConstraints(),
|
|
||||||
),
|
),
|
||||||
IconButton(
|
IconButton(
|
||||||
padding: EdgeInsets.zero,
|
|
||||||
visualDensity: VisualDensity.compact,
|
|
||||||
icon:
|
icon:
|
||||||
submitting.value
|
submitting.value
|
||||||
? SizedBox(
|
? SizedBox(
|
||||||
@@ -139,10 +145,12 @@ class PostQuickReply extends HookConsumerWidget {
|
|||||||
: Icon(Symbols.send, size: 20),
|
: Icon(Symbols.send, size: 20),
|
||||||
color: Theme.of(context).colorScheme.primary,
|
color: Theme.of(context).colorScheme.primary,
|
||||||
onPressed: submitting.value ? null : performAction,
|
onPressed: submitting.value ? null : performAction,
|
||||||
constraints: const BoxConstraints(),
|
visualDensity: VisualDensity.compact,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
loading: () => const SizedBox.shrink(),
|
loading: () => const SizedBox.shrink(),
|
||||||
error: (e, _) => const SizedBox.shrink(),
|
error: (e, _) => const SizedBox.shrink(),
|
||||||
);
|
);
|
||||||
|
@@ -36,10 +36,7 @@ class PostRepliesSheet extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
// Quick reply section
|
// Quick reply section
|
||||||
if (user.value != null)
|
if (user.value != null)
|
||||||
Material(
|
PostQuickReply(
|
||||||
elevation: 2,
|
|
||||||
color: Theme.of(context).colorScheme.surfaceContainerHigh,
|
|
||||||
child: PostQuickReply(
|
|
||||||
parent: post,
|
parent: post,
|
||||||
onPosted: () {
|
onPosted: () {
|
||||||
ref.invalidate(postRepliesNotifierProvider(post.id));
|
ref.invalidate(postRepliesNotifierProvider(post.id));
|
||||||
@@ -48,11 +45,10 @@ class PostRepliesSheet extends HookConsumerWidget {
|
|||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
},
|
},
|
||||||
).padding(
|
).padding(
|
||||||
bottom: MediaQuery.of(context).padding.bottom + 8,
|
bottom: MediaQuery.of(context).padding.bottom + 16,
|
||||||
top: 8,
|
top: 8,
|
||||||
horizontal: 16,
|
horizontal: 16,
|
||||||
),
|
),
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
Reference in New Issue
Block a user