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": { "shareAction": {
"buttonText": "Share", "buttonText": "Share",
"workInProgress": "Work in progress", "workInProgress": "Coming soon",
"markdown": "Markdown", "markdown": "Markdown",
"copyLink": "Copy Link" "copyLink": "Copy Link"
}, },

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -49,7 +49,7 @@ class DocStackContext extends HomeStackContext<int, ShareActionWrapper> {
Widget get leftBarItem => DocumentLeftBarItem(view: _view); Widget get leftBarItem => DocumentLeftBarItem(view: _view);
@override @override
Widget? get rightBarItem => DococumentShareButton(view: _view); Widget? get rightBarItem => DocumentShareButton(view: _view);
@override @override
String get identifier => _view.id; 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; 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 @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -178,14 +178,21 @@ class DococumentShareButton extends StatelessWidget {
value: Provider.of<AppearanceSettingModel>(context, listen: true), value: Provider.of<AppearanceSettingModel>(context, listen: true),
child: Selector<AppearanceSettingModel, AppLanguage>( child: Selector<AppearanceSettingModel, AppLanguage>(
selector: (ctx, notifier) => notifier.language, selector: (ctx, notifier) => notifier.language,
builder: (ctx, _, child) => RoundedTextButton( builder: (ctx, _, child) => ConstrainedBox(
title: LocaleKeys.shareAction_buttonText.tr(), constraints: BoxConstraints(
height: 30, maxHeight: 30,
width: buttonWidth, minWidth: buttonWidth,
fontSize: 12, maxWidth: 100,
borderRadius: Corners.s6Border, ),
color: Colors.lightBlue, child: RoundedTextButton(
onPressed: () => _showActionList(context, Offset(-(buttonWidth / 2), 10)), 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>( BlocListener<MenuBloc, MenuState>(
listenWhen: (p, c) => p.isCollapse != c.isCollapse, 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>( child: BlocBuilder<MenuBloc, MenuState>(

View file

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