Made sidebar permanent
This commit is contained in:
parent
575c4f9a16
commit
5e24c8ad30
3 changed files with 83 additions and 84 deletions
|
@ -15,12 +15,12 @@ class HomePage extends ReactiveWidget<HomeModel> {
|
||||||
appBar: AppBar(title: const Text("Counter")),
|
appBar: AppBar(title: const Text("Counter")),
|
||||||
body: Row(
|
body: Row(
|
||||||
children: [
|
children: [
|
||||||
AnimatedContainer(
|
SizedBox(
|
||||||
duration: Durations.short4,
|
width: 300,
|
||||||
width: model.shouldShowMarkers ? 300 : 0,
|
|
||||||
child: Sidebar(model),
|
child: Sidebar(model),
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
|
child: Card(
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
LatLongEditor(
|
LatLongEditor(
|
||||||
|
@ -77,6 +77,7 @@ class HomePage extends ReactiveWidget<HomeModel> {
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
|
@ -45,14 +45,14 @@ class LatLongEditor extends StatelessWidget {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (isShowingMarkers) IconButton(
|
const SizedBox(width: 8),
|
||||||
icon: const Icon(Icons.location_on),
|
if (isShowingMarkers) TextButton(
|
||||||
onPressed: hideMarkers,
|
onPressed: hideMarkers,
|
||||||
tooltip: "Hide stops on map",
|
child: const Text("Cancel"),
|
||||||
) else IconButton(
|
) else TextButton.icon(
|
||||||
icon: const Icon(Icons.location_off),
|
icon: const Icon(Icons.location_on),
|
||||||
onPressed: showMarkers,
|
onPressed: showMarkers,
|
||||||
tooltip: "Show stops on map",
|
label: const Text("Pick on map"),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
|
@ -10,9 +10,9 @@ class Sidebar extends ReusableReactiveWidget<HomeModel> {
|
||||||
length: 2,
|
length: 2,
|
||||||
child: Card(
|
child: Card(
|
||||||
clipBehavior: Clip.hardEdge,
|
clipBehavior: Clip.hardEdge,
|
||||||
elevation: 8,
|
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
|
const SizedBox(height: 16),
|
||||||
Text(
|
Text(
|
||||||
"Select routes",
|
"Select routes",
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
|
@ -26,31 +26,29 @@ class Sidebar extends ReusableReactiveWidget<HomeModel> {
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
),
|
),
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
TabBar(
|
if (model.shouldShowMarkers) TabBar(
|
||||||
tabs: [
|
tabs: [
|
||||||
for (final (provider, _) in model.providers)
|
for (final (provider, _) in model.providers)
|
||||||
Tab(text: provider),
|
Tab(text: provider),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: TabBarView(
|
child: !model.shouldShowMarkers
|
||||||
|
? const Center(child: Text("Choose start or end location"))
|
||||||
|
: TabBarView(
|
||||||
children: [
|
children: [
|
||||||
for (final (_, routesList) in model.providers)
|
for (final (_, routesList) in model.providers)
|
||||||
ListView(
|
ListView(
|
||||||
children: [
|
children: [
|
||||||
for (final route in routesList) ListTile(
|
for (final route in routesList) CheckboxListTile(
|
||||||
title: Text(route, maxLines: 1),
|
title: Text(route, maxLines: 1),
|
||||||
subtitle: Text(
|
subtitle: Text(
|
||||||
"${model.stopCounts[route] ?? 0} stops",
|
"${model.stopCounts[route] ?? 0} stops",
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
),
|
),
|
||||||
// Can't use CheckboxListTile, since we must remove the
|
|
||||||
// checkboxes manually to prevent layour errors
|
|
||||||
trailing: !model.shouldShowMarkers ? null : Checkbox(
|
|
||||||
value: model.routesToShow.contains(route),
|
value: model.routesToShow.contains(route),
|
||||||
onChanged: (value) => model.showRoute(route, shouldShow: value!),
|
onChanged: (value) => model.showRoute(route, shouldShow: value!),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|
Loading…
Reference in a new issue