fix apps refresh issue and share button layout issue

This commit is contained in:
appflowy 2022-01-29 22:22:34 +08:00
parent 68d4c6dbdb
commit 5a3099e323
9 changed files with 34 additions and 25 deletions

View File

@ -36,7 +36,7 @@
},
"shareAction": {
"buttonText": "Share",
"workInProgress": "Work in progress",
"workInProgress": "Coming soon",
"markdown": "Markdown",
"copyLink": "Copy Link"
},

View File

@ -36,7 +36,7 @@
},
"shareAction": {
"buttonText": "Partager",
"workInProgress": "À venir",
"workInProgress": "Bientôt disponible",
"markdown": "Markdown",
"copyLink": "Copier le liens"
},

View File

@ -36,7 +36,7 @@
},
"shareAction": {
"buttonText": "Condividi",
"workInProgress": "In corso",
"workInProgress": "Prossimamente",
"markdown": "Markdown",
"copyLink": "Copia Link"
},

View File

@ -36,7 +36,7 @@
},
"shareAction": {
"buttonText": "分享",
"workInProgress": "进行中",
"workInProgress": "敬请期待",
"markdown": "Markdown",
"copyLink": "复制链接"
},

View File

@ -49,13 +49,13 @@ class MenuBloc extends Bloc<MenuEvent, MenuState> {
Future<void> _performActionOnCreateApp(CreateApp event, Emitter<MenuState> emit) async {
final result = await workspaceManager.createApp(name: event.name, desc: event.desc);
emit(result.fold(
(app) => state.copyWith(apps: some([app])),
result.fold(
(app) => {},
(error) {
Log.error(error);
return state.copyWith(successOrFailure: right(error));
emit(state.copyWith(successOrFailure: right(error)));
},
));
);
}
// ignore: unused_element

View File

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

View File

@ -49,7 +49,7 @@ class DocStackContext extends HomeStackContext<int, ShareActionWrapper> {
Widget get leftBarItem => DocumentLeftBarItem(view: _view);
@override
Widget? get rightBarItem => DococumentShareButton(view: _view);
Widget? get rightBarItem => DocumentShareButton(view: _view);
@override
String get identifier => _view.id;
@ -150,9 +150,9 @@ class _DocumentLeftBarItemState extends State<DocumentLeftBarItem> {
}
}
class DococumentShareButton extends StatelessWidget {
class DocumentShareButton extends StatelessWidget {
final View view;
DococumentShareButton({Key? key, required this.view}) : super(key: ValueKey(view.hashCode));
DocumentShareButton({Key? key, required this.view}) : super(key: ValueKey(view.hashCode));
@override
Widget build(BuildContext context) {
@ -178,14 +178,21 @@ class DococumentShareButton extends StatelessWidget {
value: Provider.of<AppearanceSettingModel>(context, listen: true),
child: Selector<AppearanceSettingModel, AppLanguage>(
selector: (ctx, notifier) => notifier.language,
builder: (ctx, _, child) => RoundedTextButton(
title: LocaleKeys.shareAction_buttonText.tr(),
height: 30,
width: buttonWidth,
fontSize: 12,
borderRadius: Corners.s6Border,
color: Colors.lightBlue,
onPressed: () => _showActionList(context, Offset(-(buttonWidth / 2), 10)),
builder: (ctx, _, child) => ConstrainedBox(
constraints: BoxConstraints(
maxHeight: 30,
minWidth: buttonWidth,
maxWidth: 100,
),
child: RoundedTextButton(
title: LocaleKeys.shareAction_buttonText.tr(),
// height: 30,
// width: buttonWidth,
fontSize: 12,
borderRadius: Corners.s6Border,
color: Colors.lightBlue,
onPressed: () => _showActionList(context, Offset(-(buttonWidth / 2), 10)),
),
),
),
);

View File

@ -77,7 +77,9 @@ class HomeMenu extends StatelessWidget {
),
BlocListener<MenuBloc, MenuState>(
listenWhen: (p, c) => p.isCollapse != c.isCollapse,
listener: (context, state) => _collapsedNotifier.value = state.isCollapse,
listener: (context, state) {
_collapsedNotifier.value = state.isCollapse;
},
)
],
child: BlocBuilder<MenuBloc, MenuState>(

View File

@ -41,13 +41,13 @@ class _MenuAppState extends State<MenuApp> {
],
child: BlocSelector<AppBloc, AppState, AppDataNotifier>(
selector: (state) {
final menuState = Provider.of<MenuSharedState>(context, listen: false);
final menuSharedState = Provider.of<MenuSharedState>(context, listen: false);
if (state.latestCreatedView != null) {
menuState.forcedOpenView.value = state.latestCreatedView!;
menuSharedState.forcedOpenView.value = state.latestCreatedView!;
}
notifier.views = state.views;
notifier.selectedView = menuState.selectedView.value;
notifier.selectedView = menuSharedState.selectedView.value;
return notifier;
},
builder: (context, notifier) => ChangeNotifierProvider.value(