Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use fixed visual density for cw button #489

Merged
merged 2 commits into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 34 additions & 32 deletions lib/view/widget/announcement_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import '../../provider/api/announcements_notifier_provider.dart';
import '../../provider/api/i_notifier_provider.dart';
import '../../provider/misskey_colors_provider.dart';
import '../dialog/confirmation_dialog.dart';
import '../dialog/image_dialog.dart';
import 'image_widget.dart';
import 'mfm.dart';
import 'time_widget.dart';
Expand Down Expand Up @@ -40,14 +41,14 @@ class AnnouncementWidget extends ConsumerWidget {
final colors =
ref.watch(misskeyColorsProvider(Theme.of(context).brightness));

return Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
if (announcement.forYou ?? false)
Padding(
padding: const EdgeInsets.only(left: 8.0, top: 8.0),
child: Row(
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 8.0, vertical: 16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
if (announcement.forYou ?? false) ...[
Row(
children: [
Icon(
Icons.push_pin,
Expand All @@ -61,10 +62,9 @@ class AnnouncementWidget extends ConsumerWidget {
),
],
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Text.rich(
const SizedBox(height: 8.0),
],
Text.rich(
TextSpan(
children: [
if (showButton) const TextSpan(text: '🆕'),
Expand Down Expand Up @@ -94,19 +94,22 @@ class AnnouncementWidget extends ConsumerWidget {
),
style: titleStyle,
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Mfm(account: account, text: announcement.text),
),
if (imageUrl != null)
Padding(
padding: const EdgeInsets.all(8.0),
child: Center(child: ImageWidget(url: imageUrl.toString())),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: DefaultTextStyle(
const SizedBox(height: 8.0),
Mfm(account: account, text: announcement.text),
const SizedBox(height: 8.0),
if (imageUrl != null) ...[
Center(
child: InkWell(
onTap: () => showDialog<void>(
context: context,
builder: (context) => ImageDialog(url: imageUrl.toString()),
),
child: ImageWidget(url: imageUrl.toString()),
),
),
const SizedBox(height: 8.0),
],
DefaultTextStyle(
style: DefaultTextStyle.of(context).style.apply(
fontSizeFactor: 0.9,
color:
Expand All @@ -117,11 +120,9 @@ class AnnouncementWidget extends ConsumerWidget {
detailed: true,
),
),
),
if (showButton)
Padding(
padding: const EdgeInsets.all(8.0),
child: ElevatedButton(
if (showButton) ...[
const SizedBox(height: 8.0),
ElevatedButton(
onPressed: () async {
if (announcement.needConfirmationToRead ?? false) {
final confirmed = await confirm(
Expand All @@ -143,8 +144,9 @@ class AnnouncementWidget extends ConsumerWidget {
},
child: Text(t.misskey.gotIt),
),
),
],
],
],
),
);
}
}
1 change: 1 addition & 0 deletions lib/view/widget/cw_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class CwButton extends ConsumerWidget {
padding: const EdgeInsets.symmetric(vertical: 6.0, horizontal: 12.0),
minimumSize: const Size(double.infinity, 0.0),
side: BorderSide.none,
visualDensity: VisualDensity.standard,
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
),
onPressed: onPressed != null ? () => onPressed?.call(!isOpen) : null,
Expand Down
4 changes: 3 additions & 1 deletion lib/view/widget/note_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,7 @@ class NoteWidget extends HookConsumerWidget {
minimumSize:
const Size(double.infinity, 0.0),
side: BorderSide.none,
visualDensity: VisualDensity.standard,
tapTargetSize:
MaterialTapTargetSize.shrinkWrap,
),
Expand All @@ -556,7 +557,8 @@ class NoteWidget extends HookConsumerWidget {
),
const SizedBox(height: 4.0),
],
],
] else
const SizedBox(height: 2.0),
if (appearNote case Note(:final channel?)) ...[
InkWell(
onTap: () => context
Expand Down
1 change: 1 addition & 0 deletions lib/view/widget/sub_note_content.dart
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ class SubNoteContent extends HookConsumerWidget {
const EdgeInsets.symmetric(vertical: 6.0, horizontal: 12.0),
minimumSize: const Size(double.infinity, 0.0),
side: BorderSide.none,
visualDensity: VisualDensity.standard,
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
),
onPressed: () => isCollapsed.value = !isCollapsed.value,
Expand Down
Loading