Merge pull request #1010 from AppFlowy-IO/fix/merge_release_005

Fix/merge release 005
This commit is contained in:
Nathan.fooo 2022-09-08 11:52:53 +08:00 committed by GitHub
commit 5bb52ba77e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 41 additions and 33 deletions

View File

@ -197,7 +197,8 @@
"duplicate": "Duplicate", "duplicate": "Duplicate",
"delete": "Delete", "delete": "Delete",
"textPlaceholder": "Empty", "textPlaceholder": "Empty",
"copyProperty": "Copied property to clipboard" "copyProperty": "Copied property to clipboard",
"count": "Count"
}, },
"selectOption": { "selectOption": {
"create": "Create", "create": "Create",

View File

@ -41,6 +41,7 @@ class GridBloc extends Bloc<GridEvent, GridState> {
didReceiveRowUpdate: (newRowInfos, reason) { didReceiveRowUpdate: (newRowInfos, reason) {
emit(state.copyWith( emit(state.copyWith(
rowInfos: newRowInfos, rowInfos: newRowInfos,
rowCount: newRowInfos.length,
reason: reason, reason: reason,
)); ));
}, },
@ -117,6 +118,7 @@ class GridState with _$GridState {
required Option<GridPB> grid, required Option<GridPB> grid,
required GridFieldEquatable fields, required GridFieldEquatable fields,
required List<RowInfo> rowInfos, required List<RowInfo> rowInfos,
required int rowCount,
required GridLoadingState loadingState, required GridLoadingState loadingState,
required RowsChangedReason reason, required RowsChangedReason reason,
}) = _GridState; }) = _GridState;
@ -124,6 +126,7 @@ class GridState with _$GridState {
factory GridState.initial(String gridId) => GridState( factory GridState.initial(String gridId) => GridState(
fields: GridFieldEquatable(UnmodifiableListView([])), fields: GridFieldEquatable(UnmodifiableListView([])),
rowInfos: [], rowInfos: [],
rowCount: 0,
grid: none(), grid: none(),
gridId: gridId, gridId: gridId,
loadingState: const _Loading(), loadingState: const _Loading(),

View File

@ -1,7 +1,9 @@
import 'package:app_flowy/generated/locale_keys.g.dart';
import 'package:app_flowy/plugins/grid/application/field/field_controller.dart'; import 'package:app_flowy/plugins/grid/application/field/field_controller.dart';
import 'package:app_flowy/plugins/grid/application/row/row_data_controller.dart'; import 'package:app_flowy/plugins/grid/application/row/row_data_controller.dart';
import 'package:app_flowy/startup/startup.dart'; import 'package:app_flowy/startup/startup.dart';
import 'package:app_flowy/plugins/grid/application/grid_bloc.dart'; import 'package:app_flowy/plugins/grid/application/grid_bloc.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flowy_infra/theme.dart'; import 'package:flowy_infra/theme.dart';
import 'package:flowy_infra_ui/flowy_infra_ui_web.dart'; import 'package:flowy_infra_ui/flowy_infra_ui_web.dart';
import 'package:flowy_infra_ui/style_widget/scrolling/styled_list.dart'; import 'package:flowy_infra_ui/style_widget/scrolling/styled_list.dart';
@ -119,6 +121,7 @@ class _FlowyGridState extends State<FlowyGrid> {
const _GridToolbarAdaptor(), const _GridToolbarAdaptor(),
_gridHeader(context, state.gridId), _gridHeader(context, state.gridId),
Flexible(child: child), Flexible(child: child),
const RowCountBadge(),
], ],
); );
}, },
@ -307,48 +310,48 @@ class _GridFooter extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final rowCount = context.watch<GridBloc>().state.rowInfos.length;
final theme = context.watch<AppTheme>();
return SliverPadding( return SliverPadding(
padding: const EdgeInsets.only(bottom: 200), padding: const EdgeInsets.only(bottom: 200),
sliver: SliverToBoxAdapter( sliver: SliverToBoxAdapter(
child: SizedBox( child: SizedBox(
height: GridSize.footerHeight, height: GridSize.footerHeight,
child: Padding( child: Padding(
padding: GridSize.headerContentInsets, padding: GridSize.footerContentInsets,
child: Row( child: const Expanded(
children: [ child: SizedBox(height: 40, child: GridAddRowButton()),
SizedBox(width: GridSize.leadingHeaderPadding),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(width: 120, child: GridAddRowButton()),
const SizedBox(height: 30),
_rowCountTextWidget(theme: theme, count: rowCount)
],
),
],
), ),
), ),
), ),
), ),
); );
} }
}
Widget _rowCountTextWidget({required AppTheme theme, required int count}) { class RowCountBadge extends StatelessWidget {
return Row( const RowCountBadge({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
final theme = context.watch<AppTheme>();
return BlocSelector<GridBloc, GridState, int>(
selector: (state) => state.rowCount,
builder: (context, rowCount) {
return Padding(
padding: GridSize.footerContentInsets,
child: Row(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
FlowyText.regular( FlowyText.regular(
'Count : ', '${LocaleKeys.grid_row_count.tr()} : ',
fontSize: 13, fontSize: 13,
color: theme.shader3, color: theme.shader3,
), ),
FlowyText.regular( FlowyText.regular(rowCount.toString(), fontSize: 13),
count.toString(),
fontSize: 13,
),
], ],
),
);
},
); );
} }
} }

View File

@ -5,7 +5,7 @@ class GridSize {
static double get scrollBarSize => 12 * scale; static double get scrollBarSize => 12 * scale;
static double get headerHeight => 40 * scale; static double get headerHeight => 40 * scale;
static double get footerHeight => 100 * scale; static double get footerHeight => 40 * scale;
static double get leadingHeaderPadding => 50 * scale; static double get leadingHeaderPadding => 50 * scale;
static double get trailHeaderPadding => 140 * scale; static double get trailHeaderPadding => 140 * scale;
static double get headerContainerPadding => 0 * scale; static double get headerContainerPadding => 0 * scale;
@ -35,7 +35,7 @@ class GridSize {
); );
static EdgeInsets get footerContentInsets => EdgeInsets.fromLTRB( static EdgeInsets get footerContentInsets => EdgeInsets.fromLTRB(
0, GridSize.leadingHeaderPadding,
GridSize.headerContainerPadding, GridSize.headerContainerPadding,
GridSize.headerContainerPadding, GridSize.headerContainerPadding,
GridSize.headerContainerPadding, GridSize.headerContainerPadding,

View File

@ -16,7 +16,7 @@ class GridAddRowButton extends StatelessWidget {
text: const FlowyText.medium('New row', fontSize: 12), text: const FlowyText.medium('New row', fontSize: 12),
hoverColor: theme.shader6, hoverColor: theme.shader6,
onTap: () => context.read<GridBloc>().add(const GridEvent.createRow()), onTap: () => context.read<GridBloc>().add(const GridEvent.createRow()),
leftIcon: svgWidget("home/add"), leftIcon: svgWidget("home/add", color: theme.iconColor),
); );
} }
} }

View File

@ -46,6 +46,7 @@ class InitAppWidgetTask extends LaunchTask {
], ],
path: 'assets/translations', path: 'assets/translations',
fallbackLocale: const Locale('en'), fallbackLocale: const Locale('en'),
useFallbackTranslations: true,
saveLocale: false, saveLocale: false,
child: app, child: app,
), ),