fix alignment of children of bar
This commit is contained in:
parent
30af165d02
commit
97a7c43a93
3 changed files with 63 additions and 48 deletions
|
|
@ -1,3 +1,4 @@
|
||||||
|
import 'package:collection/collection.dart';
|
||||||
import 'package:flight/controllers/time_controller.dart';
|
import 'package:flight/controllers/time_controller.dart';
|
||||||
import 'package:flight/controllers/workspaces_controller.dart';
|
import 'package:flight/controllers/workspaces_controller.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
@ -11,16 +12,14 @@ class Bar extends ConsumerWidget {
|
||||||
Widget build(BuildContext context, WidgetRef ref) => Center(
|
Widget build(BuildContext context, WidgetRef ref) => Center(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: EdgeInsets.symmetric(horizontal: 8),
|
padding: EdgeInsets.symmetric(horizontal: 8),
|
||||||
child: Row(
|
child: Stack(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
children:
|
children:
|
||||||
[
|
[
|
||||||
...ref
|
ref
|
||||||
.watch(WorkspacesController.provider)
|
.watch(WorkspacesController.provider)
|
||||||
.when(
|
.when(
|
||||||
error: (error, stackTrace) => [Text(error.toString())],
|
error: (error, stackTrace) => [Text(error.toString())],
|
||||||
loading: () => [],
|
loading: () => [SizedBox.shrink()],
|
||||||
data: (value) => value
|
data: (value) => value
|
||||||
.map(
|
.map(
|
||||||
(group) => Row(
|
(group) => Row(
|
||||||
|
|
@ -40,54 +39,69 @@ class Bar extends ConsumerWidget {
|
||||||
)
|
)
|
||||||
.toList(),
|
.toList(),
|
||||||
),
|
),
|
||||||
Center(
|
[
|
||||||
child: Row(
|
TextButton(
|
||||||
mainAxisSize: MainAxisSize.min,
|
onPressed: () {},
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
child: Text(
|
||||||
|
DateFormat.Hm().format(
|
||||||
|
ref
|
||||||
|
.watch(TimeController.provider)
|
||||||
|
.when(
|
||||||
|
data: (time) => time,
|
||||||
|
loading: DateTime.now,
|
||||||
|
error: (_, _) => DateTime.now(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
|
||||||
|
[
|
||||||
|
Row(
|
||||||
children: [
|
children: [
|
||||||
TextButton(
|
IconButton(onPressed: () {}, icon: Icon(Icons.wifi)),
|
||||||
|
IconButton(
|
||||||
onPressed: () {},
|
onPressed: () {},
|
||||||
child: Text(
|
icon: Icon(Icons.bluetooth),
|
||||||
DateFormat.Hm().format(
|
),
|
||||||
ref
|
IconButton(
|
||||||
.watch(TimeController.provider)
|
onPressed: () {},
|
||||||
.when(
|
icon: Icon(Icons.volume_off),
|
||||||
data: (time) => time,
|
|
||||||
loading: DateTime.now,
|
|
||||||
error: (_, _) => DateTime.now(),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
Row(
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
IconButton(onPressed: () {}, icon: Icon(Icons.wifi)),
|
|
||||||
IconButton(onPressed: () {}, icon: Icon(Icons.bluetooth)),
|
|
||||||
IconButton(
|
|
||||||
onPressed: () {},
|
|
||||||
icon: Icon(Icons.volume_off),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
]
|
]
|
||||||
.map(
|
.mapIndexed(
|
||||||
(child) => Padding(
|
(index, children) => Align(
|
||||||
padding: EdgeInsetsGeometry.directional(bottom: 6),
|
alignment: [
|
||||||
child: Container(
|
Alignment.centerLeft,
|
||||||
height: 42,
|
Alignment.center,
|
||||||
padding: EdgeInsets.symmetric(horizontal: 12),
|
Alignment.centerRight,
|
||||||
decoration: BoxDecoration(
|
][index],
|
||||||
color: Theme.of(
|
child: Row(
|
||||||
context,
|
spacing: 8,
|
||||||
).colorScheme.surfaceContainerLow,
|
mainAxisSize: MainAxisSize.min,
|
||||||
borderRadius: BorderRadius.circular(999),
|
children: children
|
||||||
),
|
.map(
|
||||||
child: child,
|
(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(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -154,7 +154,7 @@ packages:
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "4.11.1"
|
version: "4.11.1"
|
||||||
collection:
|
collection:
|
||||||
dependency: transitive
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: collection
|
name: collection
|
||||||
sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76"
|
sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76"
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ dependencies:
|
||||||
rust_lib_flight:
|
rust_lib_flight:
|
||||||
path: rust_builder
|
path: rust_builder
|
||||||
flutter_rust_bridge: 2.11.1
|
flutter_rust_bridge: 2.11.1
|
||||||
|
collection: ^1.19.1
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
build_runner: ^2.13.1
|
build_runner: ^2.13.1
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue