-
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: add map options and stadia lines and labels to esri maps
- Loading branch information
1 parent
78c0963
commit 2f7137a
Showing
7 changed files
with
210 additions
and
14 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
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,115 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_gen/gen_l10n/app_localizations.dart'; | ||
import 'package:toggle_switch/toggle_switch.dart'; | ||
|
||
import '/src/data/data_controller.dart'; | ||
import '/src/utils/size_config.dart'; | ||
|
||
class MapOptionsFragmentView { | ||
static void showModal( | ||
BuildContext context, | ||
DataController dataController, | ||
Function setter, | ||
) { | ||
showModalBottomSheet<void>( | ||
context: context, | ||
isScrollControlled: true, | ||
barrierColor: Colors.black.withOpacity(0.1), | ||
builder: ( | ||
BuildContext context, | ||
) { | ||
SizeConfig().init(context); | ||
MediaQueryData mediaQueryData = MediaQuery.of(context); | ||
// Local working values | ||
String mapLayer = dataController.mapLayer; | ||
|
||
return StatefulBuilder( | ||
builder: ( | ||
BuildContext context, | ||
StateSetter setModalState, | ||
) { | ||
return Container( | ||
height: (25 * mediaQueryData.size.height) / 100, | ||
color: Theme.of(context).colorScheme.background, | ||
// Modal inner padding | ||
padding: EdgeInsets.symmetric( | ||
horizontal: SizeConfig.padding, | ||
), | ||
child: Center( | ||
child: ListView( | ||
children: [ | ||
Column( | ||
children: [ | ||
SizedBox( | ||
height: SizeConfig.padding, | ||
), | ||
// Modal title | ||
Text( | ||
AppLocalizations.of(context)!.mapOptionsTitle, | ||
style: TextStyle( | ||
fontWeight: FontWeight.bold, | ||
fontSize: SizeConfig.fontTextTitleSize, | ||
), | ||
), | ||
SizedBox( | ||
height: SizeConfig.padding, | ||
), | ||
// Map layer type subtitle | ||
Text( | ||
AppLocalizations.of(context)!.mapOptionsLayerStyle, | ||
style: TextStyle( | ||
fontSize: SizeConfig.fontTextLargeSize, | ||
), | ||
), | ||
SizedBox( | ||
height: SizeConfig.paddingSmall, | ||
), | ||
// Map layer type switch | ||
ToggleSwitch( | ||
customWidths: [ | ||
mediaQueryData.size.width / 3, | ||
mediaQueryData.size.width / 3, | ||
], | ||
initialLabelIndex: (mapLayer == 'osm') | ||
? 0 | ||
: 1, | ||
totalSwitches: 2, | ||
labels: [ | ||
AppLocalizations.of(context)!.mapOptionsLayerPlan, | ||
AppLocalizations.of(context)!.mapOptionsLayerSatellite, | ||
], | ||
onToggle: ( | ||
index, | ||
) { | ||
if (index == 0) { | ||
mapLayer = 'osm'; | ||
setter( | ||
'mapLayer', | ||
mapLayer, | ||
); | ||
setModalState(() {}); | ||
} else { | ||
mapLayer = 'esri'; | ||
setter( | ||
'mapLayer', | ||
mapLayer, | ||
); | ||
setModalState(() {}); | ||
} | ||
}, | ||
), | ||
SizedBox( | ||
height: SizeConfig.paddingLarge, | ||
), | ||
], | ||
), | ||
], | ||
), | ||
), | ||
); | ||
}, | ||
); | ||
}, | ||
); | ||
} | ||
} |
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