-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: basic fahrbild header with static data (#79)
- Loading branch information
1 parent
fd87ada
commit 9716686
Showing
20 changed files
with
289 additions
and
31 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"flutter": "3.24.3", | ||
"flavors": {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import 'package:auto_route/auto_route.dart'; | ||
import 'package:das_client/bloc/fahrbild_cubit.dart'; | ||
import 'package:das_client/nav/app_router.dart'; | ||
import 'package:das_client/nav/das_navigation_drawer.dart'; | ||
import 'package:das_client/pages/fahrbild/widgets/fahrbild.dart'; | ||
import 'package:design_system_flutter/design_system_flutter.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_bloc/flutter_bloc.dart'; | ||
|
||
// TODO: discuss general naming in DEV team | ||
@RoutePage() | ||
class FahrbildPage extends StatelessWidget { | ||
const FahrbildPage({super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Scaffold( | ||
appBar: _appBar(context), | ||
body: _body(context), | ||
drawer: const DASNavigationDrawer(), | ||
); | ||
} | ||
|
||
SBBHeader _appBar(BuildContext context) { | ||
return SBBHeader( | ||
title: 'Fahrbild', | ||
// TODO: Workaround as otherwise the SBB logo is shown | ||
actions: const [SizedBox.shrink()], | ||
leadingWidget: Builder( | ||
builder: (context) => IconButton( | ||
icon: const Icon(SBBIcons.hamburger_menu_small), | ||
onPressed: () => Scaffold.of(context).openDrawer(), | ||
), | ||
), | ||
); | ||
} | ||
|
||
Widget _body(BuildContext context) { | ||
return Column( | ||
children: [ | ||
Expanded(child: _content()), | ||
], | ||
); | ||
} | ||
|
||
Widget _content() { | ||
return BlocBuilder<FahrbildCubit, FahrbildState>( | ||
builder: (context, state) { | ||
if (state is FahrbildLoadedState) { | ||
return const Fahrbild(); | ||
} else if (state is FahrbildLoadedState) { | ||
// TODO: unsexy, as Listener doesn't use initial state. | ||
context.router.replace(const TrainSelectionRoute()); | ||
} | ||
|
||
return const Center(child: CircularProgressIndicator()); | ||
}, | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import 'package:das_client/pages/fahrbild/widgets/header/header.dart'; | ||
import 'package:das_client/pages/fahrbild/widgets/train_journey.dart'; | ||
import 'package:flutter/material.dart'; | ||
|
||
class Fahrbild extends StatelessWidget { | ||
const Fahrbild({super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Column( | ||
children: [ | ||
Header(), | ||
Expanded(child: TrainJourney()), | ||
], | ||
); | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
das_client/lib/pages/fahrbild/widgets/header/button_area.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import 'package:design_system_flutter/design_system_flutter.dart'; | ||
import 'package:flutter/material.dart'; | ||
|
||
class ButtonArea extends StatelessWidget { | ||
const ButtonArea({super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Row( | ||
children: [ | ||
SBBTertiaryButtonLarge(label: 'Button', onPressed: () {}), | ||
SBBIconButtonLarge(icon: SBBIcons.tick_small, onPressed: () {}), | ||
SBBIconButtonLarge(icon: SBBIcons.context_menu_small, onPressed: () {}), | ||
].withSpacing(8.0), | ||
); | ||
} | ||
} | ||
|
||
// extensions | ||
|
||
extension _Spacing on List<Widget> { | ||
withSpacing(double width) { | ||
return expand((x) => [SizedBox(width: width), x]).skip(1).toList(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
import 'package:das_client/pages/fahrbild/widgets/header/button_area.dart'; | ||
import 'package:das_client/pages/fahrbild/widgets/header/next_stop.dart'; | ||
import 'package:das_client/pages/fahrbild/widgets/header/punctuality_display.dart'; | ||
import 'package:das_client/pages/fahrbild/widgets/header/radio_channel.dart'; | ||
import 'package:design_system_flutter/design_system_flutter.dart'; | ||
import 'package:flutter/material.dart'; | ||
|
||
class Header extends StatelessWidget { | ||
const Header({super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Stack( | ||
children: [ | ||
_background(context), | ||
_group(context), | ||
], | ||
); | ||
} | ||
|
||
Widget _background(BuildContext context) { | ||
final primary = Theme.of(context).colorScheme.secondary; | ||
return Container( | ||
color: primary, | ||
height: 16.0, | ||
); | ||
} | ||
|
||
Widget _group(BuildContext context) { | ||
return SBBGroup( | ||
margin: const EdgeInsetsDirectional.fromSTEB(8, 0, 8, 16), | ||
padding: const EdgeInsets.all(16).copyWith(bottom: 8.0), | ||
useShadow: true, | ||
child: SizedBox( | ||
width: double.infinity, | ||
child: Column( | ||
crossAxisAlignment: CrossAxisAlignment.stretch, | ||
children: [ | ||
_topHeaderRow(), | ||
_divider(), | ||
_bottomHeaderRow(), | ||
], | ||
), | ||
), | ||
); | ||
} | ||
|
||
Widget _bottomHeaderRow() { | ||
return const Padding( | ||
padding: EdgeInsets.symmetric(vertical: 6.0), | ||
child: Row( | ||
children: [ | ||
RadioChannel(), | ||
SizedBox(width: 48.0), | ||
NextStop(), | ||
], | ||
), | ||
); | ||
} | ||
|
||
Widget _divider() { | ||
return const Padding( | ||
padding: EdgeInsets.symmetric(vertical: 8.0), | ||
child: Divider(height: 1.0, color: SBBColors.cloud), | ||
); | ||
} | ||
|
||
Widget _topHeaderRow() { | ||
return const Row( | ||
children: [ | ||
Expanded( | ||
child: PunctualityDisplay(), | ||
), | ||
ButtonArea(), | ||
], | ||
); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
das_client/lib/pages/fahrbild/widgets/header/next_stop.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import 'package:design_system_flutter/design_system_flutter.dart'; | ||
import 'package:flutter/material.dart'; | ||
|
||
class NextStop extends StatelessWidget { | ||
const NextStop({super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Row( | ||
children: [ | ||
const Icon(SBBIcons.station_small), | ||
const SizedBox(width: 8.0), | ||
Text('Baden', style: SBBTextStyles.largeLight), | ||
], | ||
); | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
das_client/lib/pages/fahrbild/widgets/header/punctuality_display.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import 'package:design_system_flutter/design_system_flutter.dart'; | ||
import 'package:flutter/material.dart'; | ||
|
||
class PunctualityDisplay extends StatelessWidget { | ||
const PunctualityDisplay({super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Padding( | ||
padding: const EdgeInsets.symmetric(vertical: 4.0), | ||
child: Row( | ||
children: [ | ||
Text('05:43:00', style: SBBTextStyles.largeBold.copyWith(fontSize: 24.0)), | ||
const SizedBox(width: 8.0), | ||
Text('+00:01:30', style: SBBTextStyles.largeLight.copyWith(fontSize: 24.0)), | ||
], | ||
), | ||
); | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
das_client/lib/pages/fahrbild/widgets/header/radio_channel.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import 'package:design_system_flutter/design_system_flutter.dart'; | ||
import 'package:flutter/material.dart'; | ||
|
||
class RadioChannel extends StatelessWidget { | ||
const RadioChannel({super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return ConstrainedBox( | ||
constraints: const BoxConstraints(minWidth: 240.0), | ||
child: Row( | ||
children: [ | ||
const Icon(SBBIcons.telephone_gsm_small), | ||
const SizedBox(width: 8.0), | ||
Text('1311', style: SBBTextStyles.largeLight), | ||
], | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.