Skip to content

Commit

Permalink
feat: use material symbols
Browse files Browse the repository at this point in the history
  • Loading branch information
poppingmoon committed Jan 24, 2025
1 parent fbdc90e commit 6dc5423
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 30 deletions.
5 changes: 3 additions & 2 deletions lib/view/widget/emoji_sheet.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:material_symbols_icons/symbols.dart';
import 'package:misskey_dart/misskey_dart.dart';

import '../../i18n/strings.g.dart';
Expand Down Expand Up @@ -139,7 +140,7 @@ class EmojiSheet extends ConsumerWidget {
if (!account.isGuest && host == null) ...[
if (!isPinnedForReaction)
ListTile(
leading: const Icon(Icons.push_pin),
leading: const Icon(Symbols.keep),
title: Text('${t.aria.pinToEmojiPicker} (${t.misskey.reaction})'),
onTap: () {
ref
Expand All @@ -153,7 +154,7 @@ class EmojiSheet extends ConsumerWidget {
),
if (!isPinned)
ListTile(
leading: const Icon(Icons.push_pin_outlined),
leading: const Icon(Symbols.keep_off),
title: Text('${t.aria.pinToEmojiPicker} (${t.misskey.general})'),
onTap: () {
ref
Expand Down
46 changes: 22 additions & 24 deletions lib/view/widget/note_sheet.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:material_symbols_icons/symbols.dart';
import 'package:misskey_dart/misskey_dart.dart' hide Clip;
import 'package:share_plus/share_plus.dart';

Expand Down Expand Up @@ -371,31 +372,28 @@ class NoteSheet extends ConsumerWidget {
if (!account.isGuest) ...[
if (appearNote.user.host == null &&
appearNote.user.username == account.username)
ListTile(
leading: const Icon(Icons.push_pin),
title: Text(
i?.pinnedNoteIds?.contains(appearNote.id) ?? false
? t.misskey.unpin
: t.misskey.pin,
if (i?.pinnedNoteIds?.contains(appearNote.id) ?? false)
ListTile(
leading: const Icon(Symbols.keep_off, fill: 1.0),
title: Text(t.misskey.unpin),
onTap: () => futureWithDialog(
context,
ref
.read(iNotifierProvider(account).notifier)
.unpin(appearNote.id),
),
)
else
ListTile(
leading: const Icon(Symbols.keep, fill: 1.0),
title: Text(t.misskey.pin),
onTap: () => futureWithDialog(
context,
ref
.read(iNotifierProvider(account).notifier)
.pin(appearNote.id),
),
),
onTap: () async {
if (i?.pinnedNoteIds?.contains(appearNote.id) ?? false) {
await futureWithDialog(
context,
ref
.read(iNotifierProvider(account).notifier)
.unpin(appearNote.id),
);
} else {
await futureWithDialog(
context,
ref
.read(iNotifierProvider(account).notifier)
.pin(appearNote.id),
);
}
},
),
ListTile(
leading: const Icon(Icons.attach_file),
title: Text(t.misskey.clip),
Expand Down
17 changes: 13 additions & 4 deletions lib/view/widget/role_preview.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:material_symbols_icons/symbols.dart';
import 'package:misskey_dart/misskey_dart.dart';

import '../../i18n/strings.g.dart';
Expand Down Expand Up @@ -35,16 +36,24 @@ class RolePreview extends ConsumerWidget {
width: 28.0,
height: 28.0,
),
RolesListResponse(isAdministrator: true) =>
Icon(Icons.shield, color: Theme.of(context).colorScheme.primary),
RolesListResponse(isModerator: true) =>
Icon(Icons.shield, color: Theme.of(context).colorScheme.primary),
RolesListResponse(isAdministrator: true) => Icon(
Symbols.crown,
color: Theme.of(context).colorScheme.primary,
size: 28.0,
fill: 1.0,
),
RolesListResponse(isModerator: true) => Icon(
Icons.shield,
color: Theme.of(context).colorScheme.primary,
size: 28.0,
),
_ => Icon(
Icons.person,
color: Theme.of(context)
.colorScheme
.onSurface
.withValues(alpha: 0.7),
size: 28.0,
)
},
title: Text(role.name),
Expand Down
8 changes: 8 additions & 0 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1238,6 +1238,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.11.1"
material_symbols_icons:
dependency: "direct main"
description:
name: material_symbols_icons
sha256: "89aac72d25dd49303f71b3b1e70f8374791846729365b25bebc2a2531e5b86cd"
url: "https://pub.dev"
source: hosted
version: "4.2801.1"
matrix2d:
dependency: transitive
description:
Expand Down
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ dependencies:
json_annotation: ^4.9.0
just_audio: ^0.9.43
kana_kit: ^2.1.1
material_symbols_icons: ^4.2801.1
mfm_parser:
git:
url: https://github.com/poppingmoon/dart_mfm_parser
Expand Down

0 comments on commit 6dc5423

Please sign in to comment.