Skip to content

Commit

Permalink
Revise📖
Browse files Browse the repository at this point in the history
1. 📖Change iconButton in the toolbar to CustomButton
  • Loading branch information
Cierra-Runis committed Jul 5, 2023
1 parent ad6fbbf commit 43e07ce
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ class DiaryEditorToolbarDateTimeButtonWidget extends QuillCustomButton {
final ValueChanged<Diary?> handleToolbarChangeDiary;

@override
IconData? get icon => Icons.date_range_rounded;
IconData get icon => Icons.date_range_rounded;

@override
VoidCallback? get onTap => () async {
VoidCallback get onTap => () async {
DateTime? dateTime = await showDatePicker(
context: context,
initialEntryMode: DatePickerEntryMode.calendarOnly,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,19 @@
import 'package:mercurius/index.dart';

class DiaryEditorToolbarImageButtonWidget extends QuillIconButton {
class DiaryEditorToolbarImageButtonWidget extends CustomButton {
DiaryEditorToolbarImageButtonWidget({
super.key,
super.icon = Icons.add_photo_alternate_rounded,
super.iconTheme,
required super.tooltip,
required this.controller,
required this.context,
required String path,
}) : super(
size: 18 * 1.77,
borderRadius: 12,
onPressed: () => _onPressed(controller, context, path),
);
}) : super(onPressed: () => _onPressed(controller, context, path));

final BuildContext context;
final QuillController controller;

@override
Widget? get icon => const Icon(Icons.add_photo_alternate_rounded);

static void _onPressed(
QuillController controller,
BuildContext context,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ class DiaryEditorToolbarMoodButtonWidget extends QuillCustomButton {
final ValueChanged<Diary?> handleToolbarChangeDiary;

@override
IconData? get icon => Icons.mood_rounded;
IconData get icon => Icons.mood_rounded;

@override
VoidCallback? get onTap => () async {
VoidCallback get onTap => () async {
Diary? newDiary = await showDialog<Diary>(
context: context,
builder: (context) => DiaryMoodSelectorWidget(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
import 'package:mercurius/index.dart';

class DiaryEditorToolbarTagButtonWidget extends QuillIconButton {
class DiaryEditorToolbarTagButtonWidget extends CustomButton {
DiaryEditorToolbarTagButtonWidget({
super.key,
super.icon = Icons.new_label_rounded,
super.iconTheme,
required super.tooltip,
required this.controller,
required this.context,
}) : super(
size: 18 * 1.77,
borderRadius: 12,
onPressed: () => _onPressed(controller, context),
);

final BuildContext context;
final QuillController controller;

@override
Widget? get icon => const Icon(Icons.new_label_rounded);

static void _onPressed(
QuillController controller,
BuildContext context,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ class DiaryEditorToolbarWeatherButtonWidget extends QuillCustomButton {
final ValueChanged<Diary?> handleToolbarChangeDiary;

@override
IconData? get icon => Icons.cloud;
IconData get icon => Icons.cloud;

@override
VoidCallback? get onTap => () async {
VoidCallback get onTap => () async {
Diary? newDiary = await showDialog<Diary>(
context: context,
builder: (context) => DiaryWeatherSelectorDialogWidget(
Expand Down
2 changes: 2 additions & 0 deletions lib/widgets/diary/editor/diary_editor_toolbar_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class DiaryEditorToolbarWidget extends ConsumerWidget {
error: (error, stackTrace) => Container(),
data: (data) => DiaryEditorToolbarImageButtonWidget(
tooltip: l10n.insertImage,
iconTheme: quillIconTheme,
controller: controller,
context: context,
path: data,
Expand All @@ -46,6 +47,7 @@ class DiaryEditorToolbarWidget extends ConsumerWidget {
(controller, _, __, ___) {
return DiaryEditorToolbarTagButtonWidget(
tooltip: l10n.insertTag,
iconTheme: quillIconTheme,
controller: controller,
context: context,
);
Expand Down

0 comments on commit 43e07ce

Please sign in to comment.