mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
fix: database row page breadcrumbs on smaller screens (#5289)
This commit is contained in:
parent
eeddf341e1
commit
dbbdc13d96
@ -54,12 +54,7 @@ class ViewTitleBarWithRow extends StatelessWidget {
|
|||||||
return Visibility(
|
return Visibility(
|
||||||
visible: maxWidth < constraints.maxWidth,
|
visible: maxWidth < constraints.maxWidth,
|
||||||
// if the width is too small, only show one view title bar without the ancestors
|
// if the width is too small, only show one view title bar without the ancestors
|
||||||
replacement: _ViewTitle(
|
replacement: _buildRowName(),
|
||||||
key: ValueKey(state.ancestors.last),
|
|
||||||
view: state.ancestors.last,
|
|
||||||
maxTitleWidth: constraints.maxWidth - 50.0,
|
|
||||||
onUpdated: () {},
|
|
||||||
),
|
|
||||||
child: Row(
|
child: Row(
|
||||||
// refresh the view title bar when the ancestors changed
|
// refresh the view title bar when the ancestors changed
|
||||||
key: ValueKey(state.ancestors.hashCode),
|
key: ValueKey(state.ancestors.hashCode),
|
||||||
@ -104,42 +99,39 @@ class ViewTitleBarWithRow extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildRowName() {
|
Widget _buildRowName() {
|
||||||
return BlocBuilder<DatabaseDocumentTitleBloc, DatabaseDocumentTitleState>(
|
return _RowName(
|
||||||
builder: (context, state) {
|
rowId: rowId,
|
||||||
if (state.databaseController == null) {
|
|
||||||
return const SizedBox.shrink();
|
|
||||||
}
|
|
||||||
return _RowName(
|
|
||||||
cellBuilder: EditableCellBuilder(
|
|
||||||
databaseController: state.databaseController!,
|
|
||||||
),
|
|
||||||
primaryFieldId: state.fieldId!,
|
|
||||||
rowId: rowId,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class _RowName extends StatelessWidget {
|
class _RowName extends StatelessWidget {
|
||||||
const _RowName({
|
const _RowName({
|
||||||
required this.cellBuilder,
|
|
||||||
required this.primaryFieldId,
|
|
||||||
required this.rowId,
|
required this.rowId,
|
||||||
});
|
});
|
||||||
|
|
||||||
final EditableCellBuilder cellBuilder;
|
|
||||||
final String primaryFieldId;
|
|
||||||
final String rowId;
|
final String rowId;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return cellBuilder.buildCustom(
|
return BlocBuilder<DatabaseDocumentTitleBloc, DatabaseDocumentTitleState>(
|
||||||
CellContext(
|
builder: (context, state) {
|
||||||
fieldId: primaryFieldId,
|
if (state.databaseController == null) {
|
||||||
rowId: rowId,
|
return const SizedBox.shrink();
|
||||||
),
|
}
|
||||||
skinMap: EditableCellSkinMap(textSkin: _TitleSkin()),
|
|
||||||
|
final cellBuilder = EditableCellBuilder(
|
||||||
|
databaseController: state.databaseController!,
|
||||||
|
);
|
||||||
|
|
||||||
|
return cellBuilder.buildCustom(
|
||||||
|
CellContext(
|
||||||
|
fieldId: state.fieldId!,
|
||||||
|
rowId: rowId,
|
||||||
|
),
|
||||||
|
skinMap: EditableCellSkinMap(textSkin: _TitleSkin()),
|
||||||
|
);
|
||||||
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -220,12 +212,10 @@ enum _ViewTitleBehavior {
|
|||||||
|
|
||||||
class _ViewTitle extends StatefulWidget {
|
class _ViewTitle extends StatefulWidget {
|
||||||
const _ViewTitle({
|
const _ViewTitle({
|
||||||
super.key,
|
|
||||||
required this.view,
|
required this.view,
|
||||||
this.behavior = _ViewTitleBehavior.editable,
|
this.behavior = _ViewTitleBehavior.editable,
|
||||||
this.maxTitleWidth = 180,
|
|
||||||
required this.onUpdated,
|
required this.onUpdated,
|
||||||
});
|
}) : maxTitleWidth = 180;
|
||||||
|
|
||||||
final ViewPB view;
|
final ViewPB view;
|
||||||
final _ViewTitleBehavior behavior;
|
final _ViewTitleBehavior behavior;
|
||||||
|
Loading…
Reference in New Issue
Block a user