-
-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ac62961
commit c6925be
Showing
19 changed files
with
800 additions
and
547 deletions.
There are no files selected for viewing
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,89 @@ | ||
part of '../main.dart'; | ||
|
||
class _HorizontalLayout extends StatelessWidget { | ||
const _HorizontalLayout({ | ||
required DraggableScrollableController bottomSheetOuterController, | ||
required this.mapMode, | ||
required this.selectedTab, | ||
}) : _bottomSheetOuterController = bottomSheetOuterController; | ||
|
||
final DraggableScrollableController _bottomSheetOuterController; | ||
final MapViewMode mapMode; | ||
final int selectedTab; | ||
|
||
@override | ||
Widget build(BuildContext context) => Scaffold( | ||
backgroundColor: Theme.of(context).colorScheme.surfaceContainer, | ||
body: LayoutBuilder( | ||
builder: (context, constraints) => Row( | ||
children: [ | ||
NavigationRail( | ||
backgroundColor: Colors.transparent, | ||
destinations: [ | ||
const NavigationRailDestination( | ||
icon: Icon(Icons.map_outlined), | ||
selectedIcon: Icon(Icons.map), | ||
label: Text('Map'), | ||
), | ||
NavigationRailDestination( | ||
icon: Selector<DownloadingProvider, bool>( | ||
selector: (context, provider) => | ||
provider.storeName != null, | ||
builder: (context, isDownloading, child) => | ||
!isDownloading ? child! : Badge(child: child), | ||
child: const Icon(Icons.download_outlined), | ||
), | ||
selectedIcon: const Icon(Icons.download), | ||
label: const Text('Download'), | ||
), | ||
NavigationRailDestination( | ||
icon: Selector<RecoverableRegionsProvider, int>( | ||
selector: (context, provider) => | ||
provider.failedRegions.length, | ||
builder: (context, count, child) => count == 0 | ||
? child! | ||
: Badge.count(count: count, child: child), | ||
child: const Icon(Icons.support_outlined), | ||
), | ||
selectedIcon: const Icon(Icons.support), | ||
label: const Text('Recovery'), | ||
), | ||
], | ||
selectedIndex: selectedTab, | ||
labelType: NavigationRailLabelType.all, | ||
leading: Padding( | ||
padding: const EdgeInsets.only(top: 8, bottom: 16), | ||
child: ClipRRect( | ||
borderRadius: BorderRadius.circular(12), | ||
child: Image.asset( | ||
'assets/icons/ProjectIcon.png', | ||
width: 54, | ||
height: 54, | ||
filterQuality: FilterQuality.high, | ||
), | ||
), | ||
), | ||
onDestinationSelected: (i) => selectedTabState.value = i, | ||
), | ||
SecondaryViewSide( | ||
selectedTab: selectedTab, | ||
constraints: constraints, | ||
), | ||
Expanded( | ||
child: ClipRRect( | ||
borderRadius: const BorderRadius.only( | ||
topLeft: Radius.circular(16), | ||
bottomLeft: Radius.circular(16), | ||
), | ||
child: MapView( | ||
bottomSheetOuterController: _bottomSheetOuterController, | ||
mode: mapMode, | ||
layoutDirection: Axis.horizontal, | ||
), | ||
), | ||
), | ||
], | ||
), | ||
), | ||
); | ||
} |
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,115 @@ | ||
part of '../main.dart'; | ||
|
||
class _VerticalLayout extends StatelessWidget { | ||
const _VerticalLayout({ | ||
required DraggableScrollableController bottomSheetOuterController, | ||
required this.mapMode, | ||
required this.selectedTab, | ||
required this.constrainedHeight, | ||
}) : _bottomSheetOuterController = bottomSheetOuterController; | ||
|
||
final DraggableScrollableController _bottomSheetOuterController; | ||
final MapViewMode mapMode; | ||
final int selectedTab; | ||
final double constrainedHeight; | ||
|
||
@override | ||
Widget build(BuildContext context) => Scaffold( | ||
body: BottomSheetMapWrapper( | ||
bottomSheetOuterController: _bottomSheetOuterController, | ||
mode: mapMode, | ||
layoutDirection: Axis.vertical, | ||
), | ||
bottomSheet: SecondaryViewBottomSheet( | ||
selectedTab: selectedTab, | ||
controller: _bottomSheetOuterController, | ||
), | ||
floatingActionButton: selectedTab == 1 && | ||
context | ||
.watch<RegionSelectionProvider>() | ||
.constructedRegions | ||
.isNotEmpty | ||
? DelayedControllerAttachmentBuilder( | ||
listenable: _bottomSheetOuterController, | ||
builder: (context, _) => AnimatedBuilder( | ||
animation: _bottomSheetOuterController, | ||
builder: (context, _) { | ||
final pixels = _bottomSheetOuterController.isAttached | ||
? _bottomSheetOuterController.pixels | ||
: 0; | ||
return FloatingActionButton( | ||
onPressed: () async { | ||
await _bottomSheetOuterController.animateTo( | ||
2 / 3, | ||
duration: const Duration(milliseconds: 250), | ||
curve: Curves.easeOut, | ||
); | ||
if (!context.mounted) return; | ||
prepareDownloadConfigView( | ||
context, | ||
shouldShowConfig: pixels > 33, | ||
); | ||
}, | ||
tooltip: | ||
pixels <= 33 ? 'Show regions' : 'Configure download', | ||
child: pixels <= 33 | ||
? const Icon(Icons.library_add_check) | ||
: const Icon(Icons.tune), | ||
); | ||
}, | ||
), | ||
) | ||
: null, | ||
bottomNavigationBar: NavigationBar( | ||
selectedIndex: selectedTab, | ||
destinations: [ | ||
const NavigationDestination( | ||
icon: Icon(Icons.map_outlined), | ||
selectedIcon: Icon(Icons.map), | ||
label: 'Map', | ||
), | ||
NavigationDestination( | ||
icon: Selector<DownloadingProvider, bool>( | ||
selector: (context, provider) => provider.storeName != null, | ||
builder: (context, isDownloading, child) => | ||
!isDownloading ? child! : Badge(child: child), | ||
child: const Icon(Icons.download_outlined), | ||
), | ||
selectedIcon: const Icon(Icons.download), | ||
label: 'Download', | ||
), | ||
NavigationDestination( | ||
icon: Selector<RecoverableRegionsProvider, int>( | ||
selector: (context, provider) => provider.failedRegions.length, | ||
builder: (context, count, child) => count == 0 | ||
? child! | ||
: Badge.count(count: count, child: child), | ||
child: const Icon(Icons.support_outlined), | ||
), | ||
selectedIcon: const Icon(Icons.support), | ||
label: 'Recovery', | ||
), | ||
], | ||
onDestinationSelected: (i) { | ||
selectedTabState.value = i; | ||
if (i == 1) { | ||
WidgetsBinding.instance.addPostFrameCallback( | ||
(_) => _bottomSheetOuterController.animateTo( | ||
32 / constrainedHeight, | ||
duration: const Duration(milliseconds: 250), | ||
curve: Curves.easeOut, | ||
), | ||
); | ||
} else { | ||
WidgetsBinding.instance.addPostFrameCallback( | ||
(_) => _bottomSheetOuterController.animateTo( | ||
0.3, | ||
duration: const Duration(milliseconds: 250), | ||
curve: Curves.easeOut, | ||
), | ||
); | ||
} | ||
}, | ||
), | ||
); | ||
} |
Oops, something went wrong.