Merge branch 'chat/header-islands'
# Conflicts: # app/tool/capture/README.md
This commit is contained in:
@@ -63,6 +63,7 @@ class SegmentedBar extends StatefulWidget
|
||||
this.titleSemanticLabel,
|
||||
this.titleKey,
|
||||
this.actions = const [],
|
||||
this.separateActionIslands = false,
|
||||
this.actionsKey,
|
||||
this.backgroundColor,
|
||||
this.pillColor,
|
||||
@@ -115,6 +116,10 @@ class SegmentedBar extends StatefulWidget
|
||||
/// its own (see [SegmentedEntrancePlanner]).
|
||||
final List<Widget> actions;
|
||||
|
||||
/// Each action is an independently filled island, ordered before the next.
|
||||
/// Use non-overflowable group widgets to keep related controls together.
|
||||
final bool separateActionIslands;
|
||||
|
||||
/// Who supplies [actions] (a shell's open screen): when it changes, every
|
||||
/// action is new and pops in, though one has the same key as before.
|
||||
final Object? actionsKey;
|
||||
@@ -338,7 +343,18 @@ class _SegmentedBarState extends State<SegmentedBar> {
|
||||
cupertino: cupertino,
|
||||
tint: widget.foregroundColor,
|
||||
enabled: actions.length > 1,
|
||||
child: action,
|
||||
child: widget.separateActionIslands
|
||||
? Padding(
|
||||
padding: EdgeInsetsDirectional.only(
|
||||
start: index == 0 ? 0 : 8,
|
||||
),
|
||||
child: SegmentedPill(
|
||||
cupertino: cupertino,
|
||||
fill: widget.pillColor,
|
||||
child: action,
|
||||
),
|
||||
)
|
||||
: action,
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -346,6 +362,14 @@ class _SegmentedBarState extends State<SegmentedBar> {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _actionsIsland({
|
||||
required bool cupertino,
|
||||
Color? fill,
|
||||
required Widget child,
|
||||
}) => widget.separateActionIslands
|
||||
? child
|
||||
: SegmentedPill(cupertino: cupertino, fill: fill, child: child);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final cupertino = widget.cupertino;
|
||||
@@ -417,6 +441,9 @@ class _SegmentedBarState extends State<SegmentedBar> {
|
||||
width * SegmentedBar.maxTitleShare,
|
||||
),
|
||||
);
|
||||
final minimumTitleShare = widget.separateActionIslands
|
||||
? .10
|
||||
: SegmentedBar.minTitleShare;
|
||||
final besideTitle =
|
||||
width -
|
||||
(leading == null ? 0 : segmentedPieceHeight(cupertino) + 8) -
|
||||
@@ -426,7 +453,7 @@ class _SegmentedBarState extends State<SegmentedBar> {
|
||||
// before the title goes under its own width.
|
||||
final actionsMaxWidth = math.max(
|
||||
0.0,
|
||||
besideTitle - width * SegmentedBar.minTitleShare,
|
||||
besideTitle - width * minimumTitleShare,
|
||||
);
|
||||
final overflowWidth = math.max(0.0, besideTitle - titleMinimum);
|
||||
return Row(
|
||||
@@ -479,7 +506,7 @@ class _SegmentedBarState extends State<SegmentedBar> {
|
||||
cupertino: cupertino,
|
||||
tint: foregroundColor,
|
||||
enabled: actions.length == 1,
|
||||
child: SegmentedPill(
|
||||
child: _actionsIsland(
|
||||
cupertino: cupertino,
|
||||
fill: pillColor,
|
||||
child: _actionRow(
|
||||
|
||||
Reference in New Issue
Block a user