fix view listen issue because of the notifier didn't dispose.

This commit is contained in:
appflowy 2022-01-28 21:29:09 +08:00
parent 814f9f4c19
commit 564af73076
10 changed files with 21 additions and 16 deletions

View File

@ -31,7 +31,7 @@ class AppWidgetTask extends LaunchTask {
supportedLocales: const [Locale('en'), Locale('zh', 'CN'), Locale('it', 'IT'), Locale('fr', 'CA')],
path: 'assets/translations',
fallbackLocale: const Locale('en'),
child: app),
child: app),
);
},
blocObserver: ApplicationBlocObserver(),
@ -56,7 +56,7 @@ class ApplicationWidget extends StatelessWidget {
value: settingModel,
builder: (context, _) {
const ratio = 1.73;
const minWidth = 800.0;
const minWidth = 1000.0;
setWindowMinSize(const Size(minWidth, minWidth / ratio));
AppTheme theme = context.select<AppearanceSettingModel, AppTheme>(
(value) => value.theme,

View File

@ -20,7 +20,6 @@ import 'package:app_flowy/workspace/infrastructure/repos/doc_repo.dart';
import 'package:app_flowy/workspace/infrastructure/repos/trash_repo.dart';
import 'package:app_flowy/workspace/infrastructure/repos/view_repo.dart';
import 'package:app_flowy/workspace/infrastructure/repos/workspace_repo.dart';
import 'package:flowy_sdk/protobuf/flowy-user-data-model/protobuf.dart' show UserProfile;
import 'package:flowy_sdk/protobuf/flowy-folder-data-model/app.pb.dart';
import 'package:flowy_sdk/protobuf/flowy-folder-data-model/view.pb.dart';
import 'package:get_it/get_it.dart';

View File

@ -86,6 +86,9 @@ class IUserListenerImpl extends IUserListener {
@override
Future<void> stop() async {
await _subscription?.cancel();
profileUpdatedNotifier.dispose();
authDidChangedNotifier.dispose();
workspaceUpdatedNotifier.dispose();
}
void _notificationCallback(FolderNotification ty, Either<Uint8List, FlowyError> result) {

View File

@ -109,5 +109,7 @@ class AppListenerRepository {
Future<void> close() async {
await _subscription?.cancel();
_viewsChanged = null;
_update = null;
}
}

View File

@ -72,5 +72,6 @@ class TrashListenerRepo {
Future<void> close() async {
await _subscription?.cancel();
_trashUpdated = null;
}
}

View File

@ -99,5 +99,8 @@ class ViewListenerRepository {
Future<void> close() async {
await _subscription?.cancel();
updatedNotifier.dispose();
deletedNotifier.dispose();
restoredNotifier.dispose();
}
}

View File

@ -123,5 +123,7 @@ class WorkspaceListenerRepo {
Future<void> close() async {
await _subscription?.cancel();
_appsChanged = null;
_update = null;
}
}

View File

@ -43,10 +43,10 @@ class DocStackContext extends HomeStackContext<int, ShareActionWrapper> {
}
@override
Widget get leftBarItem => DocLeftBarItem(view: _view);
Widget get leftBarItem => DocumentLeftBarItem(view: _view);
@override
Widget? get rightBarItem => DocShareButton(view: _view);
Widget? get rightBarItem => DococumentShareButton(view: _view);
@override
String get identifier => _view.id;
@ -79,16 +79,16 @@ class DocStackContext extends HomeStackContext<int, ShareActionWrapper> {
}
}
class DocLeftBarItem extends StatefulWidget {
class DocumentLeftBarItem extends StatefulWidget {
final View view;
DocLeftBarItem({required this.view, Key? key}) : super(key: ValueKey(view.hashCode));
DocumentLeftBarItem({required this.view, Key? key}) : super(key: ValueKey(view.hashCode));
@override
State<DocLeftBarItem> createState() => _DocLeftBarItemState();
State<DocumentLeftBarItem> createState() => _DocumentLeftBarItemState();
}
class _DocLeftBarItemState extends State<DocLeftBarItem> {
class _DocumentLeftBarItemState extends State<DocumentLeftBarItem> {
final _controller = TextEditingController();
final _focusNode = FocusNode();
late ViewRepository repo;
@ -147,9 +147,9 @@ class _DocLeftBarItemState extends State<DocLeftBarItem> {
}
}
class DocShareButton extends StatelessWidget {
class DococumentShareButton extends StatelessWidget {
final View view;
DocShareButton({Key? key, required this.view}) : super(key: ValueKey(view.hashCode));
DococumentShareButton({Key? key, required this.view}) : super(key: ValueKey(view.hashCode));
@override
Widget build(BuildContext context) {
@ -189,13 +189,11 @@ class DocShareButton extends StatelessWidget {
void _handleExportData(ExportData exportData) {
switch (exportData.exportType) {
case ExportType.Link:
// TODO: Handle this case.
break;
case ExportType.Markdown:
FlutterClipboard.copy(exportData.data).then((value) => Log.info('copied to clipboard'));
break;
case ExportType.Text:
// TODO: Handle this case.
break;
}
}

View File

@ -41,8 +41,6 @@ enum OverlapBehaviour {
stretch,
}
// TODO: junlin - support route pop handler
/// [Unsupported] The behavior of overlay when user tapping system back button
enum OnBackBehavior {
/// Won't handle the back action
none,

View File

@ -26,7 +26,6 @@ import 'package:flowy_sdk/protobuf/flowy-collaboration/protobuf.dart';
import 'package:flowy_sdk/protobuf/lib-infra/protobuf.dart';
import 'package:protobuf/protobuf.dart';
import 'dart:convert' show utf8;
import '../protobuf/flowy-user-data-model/user_setting.pb.dart';
import 'error.dart';
part 'code_gen.dart';