Lucas.Xu 0683483fd4
fix: editor page issues (#4055)
* fix: disable editor in card detail page

* fix: mobile toolbar disappears after editing link

* fix: favorite icon shows incorrectly

* fix: inkWell when pressing on the Trash is different from the rest of our list tiles in the app

* fix: recent view didn't update after deleting view

* fix: trash button too small

* feat: use new bottom sheet style in cover plugin

* feat: use new bottom sheet style in add new page

* feat: use new bottom sheet style in view page option

* feat: use new bottom sheet style in image block

* feat: use new bottom sheet style in settings block and edit link menu

* fix: data picker doesn't show

* fix: flutter analyze
2023-12-01 09:58:36 +08:00

68 lines
2.1 KiB
Dart

import 'package:appflowy/mobile/presentation/database/board/mobile_board_screen.dart';
import 'package:appflowy/mobile/presentation/database/mobile_calendar_screen.dart';
import 'package:appflowy/mobile/presentation/database/mobile_grid_screen.dart';
import 'package:appflowy/mobile/presentation/presentation.dart';
import 'package:appflowy/workspace/application/recent/recent_service.dart';
import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
extension MobileRouter on BuildContext {
Future<void> pushView(ViewPB view) async {
push(
Uri(
path: view.routeName,
queryParameters: view.queryParameters,
).toString(),
).then((value) {
RecentService().updateRecentViews([view.id], true);
});
}
}
extension on ViewPB {
String get routeName {
switch (layout) {
case ViewLayoutPB.Document:
return MobileEditorScreen.routeName;
case ViewLayoutPB.Grid:
return MobileGridScreen.routeName;
case ViewLayoutPB.Calendar:
return MobileCalendarScreen.routeName;
case ViewLayoutPB.Board:
return MobileBoardScreen.routeName;
default:
throw UnimplementedError('routeName for $this is not implemented');
}
}
Map<String, dynamic> get queryParameters {
switch (layout) {
case ViewLayoutPB.Document:
return {
MobileEditorScreen.viewId: id,
MobileEditorScreen.viewTitle: name,
};
case ViewLayoutPB.Grid:
return {
MobileGridScreen.viewId: id,
MobileGridScreen.viewTitle: name,
};
case ViewLayoutPB.Calendar:
return {
MobileCalendarScreen.viewId: id,
MobileCalendarScreen.viewTitle: name,
};
case ViewLayoutPB.Board:
return {
MobileBoardScreen.viewId: id,
MobileBoardScreen.viewTitle: name,
};
default:
throw UnimplementedError(
'queryParameters for $this is not implemented',
);
}
}
}