Order displays based on logical position
This commit is contained in:
parent
f6dbb37a02
commit
1ba6c8a026
4 changed files with 228 additions and 180 deletions
|
|
@ -9,104 +9,98 @@ class Bar extends ConsumerWidget {
|
|||
const Bar({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) => Center(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 8),
|
||||
child: Stack(
|
||||
children:
|
||||
[
|
||||
ref
|
||||
.watch(WorkspacesController.provider)
|
||||
.when(
|
||||
error: (error, stackTrace) => [Text(error.toString())],
|
||||
loading: () => [SizedBox.shrink()],
|
||||
data: (value) => value
|
||||
.map(
|
||||
(group) => Row(
|
||||
children: group
|
||||
.map(
|
||||
(workspace) => IconButton(
|
||||
onPressed: () => workspace.activate(),
|
||||
icon: Icon(
|
||||
workspace.activated
|
||||
? Icons.circle
|
||||
: Icons.circle_outlined,
|
||||
),
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
),
|
||||
[
|
||||
TextButton(
|
||||
onPressed: () {},
|
||||
child: Text(
|
||||
DateFormat.Hm().format(
|
||||
ref
|
||||
.watch(TimeController.provider)
|
||||
.when(
|
||||
data: (time) => time,
|
||||
loading: DateTime.now,
|
||||
error: (_, _) => DateTime.now(),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
[
|
||||
Row(
|
||||
children: [
|
||||
IconButton(onPressed: () {}, icon: Icon(Icons.wifi)),
|
||||
IconButton(
|
||||
onPressed: () {},
|
||||
icon: Icon(Icons.bluetooth),
|
||||
),
|
||||
IconButton(
|
||||
onPressed: () {},
|
||||
icon: Icon(Icons.volume_off),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
]
|
||||
.mapIndexed(
|
||||
(index, children) => Align(
|
||||
alignment: [
|
||||
Alignment.centerLeft,
|
||||
Alignment.center,
|
||||
Alignment.centerRight,
|
||||
][index],
|
||||
child: Row(
|
||||
spacing: 8,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: children
|
||||
Widget build(BuildContext context, WidgetRef ref) => Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 8),
|
||||
child: Stack(
|
||||
children:
|
||||
[
|
||||
ref
|
||||
.watch(WorkspacesController.provider)
|
||||
.when(
|
||||
error: (error, stackTrace) => [Text(error.toString())],
|
||||
loading: () => [SizedBox.shrink()],
|
||||
data: (value) => value
|
||||
.map(
|
||||
(child) => Padding(
|
||||
padding: EdgeInsetsGeometry.directional(
|
||||
bottom: 6,
|
||||
),
|
||||
child: Container(
|
||||
height: 42,
|
||||
padding: EdgeInsets.symmetric(horizontal: 12),
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(
|
||||
context,
|
||||
).colorScheme.surfaceContainerLow,
|
||||
borderRadius: BorderRadius.circular(999),
|
||||
),
|
||||
child: child,
|
||||
),
|
||||
(group) => Row(
|
||||
children: group
|
||||
.map(
|
||||
(workspace) => IconButton(
|
||||
onPressed: () => workspace.activate(),
|
||||
icon: Icon(
|
||||
workspace.activated
|
||||
? Icons.circle
|
||||
: Icons.circle_outlined,
|
||||
),
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
),
|
||||
[
|
||||
TextButton(
|
||||
onPressed: () {},
|
||||
child: Text(
|
||||
DateFormat.Hm().format(
|
||||
ref
|
||||
.watch(TimeController.provider)
|
||||
.when(
|
||||
data: (time) => time,
|
||||
loading: DateTime.now,
|
||||
error: (_, _) => DateTime.now(),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
),
|
||||
],
|
||||
|
||||
[
|
||||
Row(
|
||||
children: [
|
||||
IconButton(onPressed: () {}, icon: Icon(Icons.wifi)),
|
||||
IconButton(onPressed: () {}, icon: Icon(Icons.bluetooth)),
|
||||
|
||||
IconButton(
|
||||
onPressed: () {},
|
||||
icon: Icon(Icons.volume_off),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
]
|
||||
.mapIndexed(
|
||||
(index, children) => Align(
|
||||
alignment: [
|
||||
Alignment.centerLeft,
|
||||
Alignment.center,
|
||||
Alignment.centerRight,
|
||||
][index],
|
||||
child: Row(
|
||||
spacing: 8,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: children
|
||||
.map(
|
||||
(child) => Padding(
|
||||
padding: EdgeInsetsGeometry.directional(bottom: 6),
|
||||
child: Container(
|
||||
height: 42,
|
||||
padding: EdgeInsets.symmetric(horizontal: 12),
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(
|
||||
context,
|
||||
).colorScheme.surfaceContainerLow,
|
||||
borderRadius: BorderRadius.circular(999),
|
||||
),
|
||||
child: child,
|
||||
),
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
),
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue