Skip to content

Commit

Permalink
responsive annotation layout
Browse files Browse the repository at this point in the history
  • Loading branch information
josxha committed Jun 3, 2024
1 parent 7284235 commit adf9ab9
Show file tree
Hide file tree
Showing 13 changed files with 550 additions and 644 deletions.
179 changes: 81 additions & 98 deletions example/lib/annotation_circle_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -177,109 +177,92 @@ class _AnnotationCirclePageState extends State<AnnotationCirclePage> {
@override
Widget build(BuildContext context) {
return ExampleScaffold(
page: ExamplePage.circle,
page: ExamplePage.annotationCircle,
body: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
Center(
child: SizedBox(
width: 300.0,
height: 200.0,
child: MaplibreMap(
onMapCreated: _onMapCreated,
initialCameraPosition: const CameraPosition(
target: LatLng(-33.852, 151.211),
zoom: 11.0,
),
Wrap(
alignment: WrapAlignment.center,
children: <Widget>[
TextButton(
onPressed: (_circleCount == 12) ? null : _add,
child: const Text('add'),
),
),
TextButton(
onPressed: (_selectedCircle == null) ? null : _remove,
child: const Text('remove'),
),
],
),
Wrap(
alignment: WrapAlignment.center,
children: <Widget>[
TextButton(
onPressed: (_selectedCircle == null)
? null
: _changeCircleOpacity,
child: const Text('change circle-opacity'),
),
TextButton(
onPressed: (_selectedCircle == null)
? null
: _changeCircleRadius,
child: const Text('change circle-radius'),
),
TextButton(
onPressed: (_selectedCircle == null)
? null
: _changeCircleColor,
child: const Text('change circle-color'),
),
TextButton(
onPressed: (_selectedCircle == null)
? null
: _changeCircleBlur,
child: const Text('change circle-blur'),
),
TextButton(
onPressed: (_selectedCircle == null)
? null
: _changeCircleStrokeWidth,
child: const Text('change circle-stroke-width'),
),
TextButton(
onPressed: (_selectedCircle == null)
? null
: _changeCircleStrokeColor,
child: const Text('change circle-stroke-color'),
),
TextButton(
onPressed: (_selectedCircle == null)
? null
: _changeCircleStrokeOpacity,
child: const Text('change circle-stroke-opacity'),
),
TextButton(
onPressed: (_selectedCircle == null)
? null
: _changePosition,
child: const Text('change position'),
),
TextButton(
onPressed: (_selectedCircle == null)
? null
: _changeDraggable,
child: const Text('toggle draggable'),
),
TextButton(
onPressed:
(_selectedCircle == null) ? null : _getLatLng,
child: const Text('get current LatLng'),
),
],
),
Expanded(
child: SingleChildScrollView(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Row(
children: <Widget>[
Column(
children: <Widget>[
TextButton(
onPressed: (_circleCount == 12) ? null : _add,
child: const Text('add'),
),
TextButton(
onPressed: (_selectedCircle == null) ? null : _remove,
child: const Text('remove'),
),
],
),
Column(
children: <Widget>[
TextButton(
onPressed: (_selectedCircle == null)
? null
: _changeCircleOpacity,
child: const Text('change circle-opacity'),
),
TextButton(
onPressed: (_selectedCircle == null)
? null
: _changeCircleRadius,
child: const Text('change circle-radius'),
),
TextButton(
onPressed: (_selectedCircle == null)
? null
: _changeCircleColor,
child: const Text('change circle-color'),
),
TextButton(
onPressed: (_selectedCircle == null)
? null
: _changeCircleBlur,
child: const Text('change circle-blur'),
),
TextButton(
onPressed: (_selectedCircle == null)
? null
: _changeCircleStrokeWidth,
child: const Text('change circle-stroke-width'),
),
TextButton(
onPressed: (_selectedCircle == null)
? null
: _changeCircleStrokeColor,
child: const Text('change circle-stroke-color'),
),
TextButton(
onPressed: (_selectedCircle == null)
? null
: _changeCircleStrokeOpacity,
child: const Text('change circle-stroke-opacity'),
),
TextButton(
onPressed: (_selectedCircle == null)
? null
: _changePosition,
child: const Text('change position'),
),
TextButton(
onPressed: (_selectedCircle == null)
? null
: _changeDraggable,
child: const Text('toggle draggable'),
),
TextButton(
onPressed:
(_selectedCircle == null) ? null : _getLatLng,
child: const Text('get current LatLng'),
),
],
),
],
)
],
child: MaplibreMap(
onMapCreated: _onMapCreated,
initialCameraPosition: const CameraPosition(
target: LatLng(-33.852, 151.211),
zoom: 11.0,
),
),
),
Expand Down
129 changes: 56 additions & 73 deletions example/lib/annotation_fill_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -175,84 +175,67 @@ class _AnnotationFillPageState extends State<AnnotationFillPage> {
@override
Widget build(BuildContext context) {
return ExampleScaffold(
page: ExamplePage.fill,
page: ExamplePage.annotationFill,
body: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
Center(
child: SizedBox(
width: 300.0,
height: 200.0,
child: MaplibreMap(
onMapCreated: _onMapCreated,
onStyleLoadedCallback: _onStyleLoaded,
initialCameraPosition: const CameraPosition(
target: LatLng(-33.852, 151.211),
zoom: 7.0,
),
Wrap(
alignment: WrapAlignment.center,
children: <Widget>[
TextButton(
onPressed: (_fillCount == 12) ? null : _add,
child: const Text('add'),
),
),
TextButton(
onPressed: (_selectedFill == null) ? null : _remove,
child: const Text('remove'),
),
],
),
Wrap(
alignment: WrapAlignment.center,
children: <Widget>[
TextButton(
onPressed: (_selectedFill == null)
? null
: _changeFillOpacity,
child: const Text('change fill-opacity'),
),
TextButton(
onPressed:
(_selectedFill == null) ? null : _changeFillColor,
child: const Text('change fill-color'),
),
TextButton(
onPressed: (_selectedFill == null)
? null
: _changeFillOutlineColor,
child: const Text('change fill-outline-color'),
),
TextButton(
onPressed: (_selectedFill == null)
? null
: _changeFillPattern,
child: const Text('change fill-pattern'),
),
TextButton(
onPressed:
(_selectedFill == null) ? null : _changePosition,
child: const Text('change position'),
),
TextButton(
onPressed:
(_selectedFill == null) ? null : _changeDraggable,
child: const Text('toggle draggable'),
),
],
),
Expanded(
child: SingleChildScrollView(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Row(
children: <Widget>[
Column(
children: <Widget>[
TextButton(
onPressed: (_fillCount == 12) ? null : _add,
child: const Text('add'),
),
TextButton(
onPressed: (_selectedFill == null) ? null : _remove,
child: const Text('remove'),
),
],
),
Column(
children: <Widget>[
TextButton(
onPressed: (_selectedFill == null)
? null
: _changeFillOpacity,
child: const Text('change fill-opacity'),
),
TextButton(
onPressed:
(_selectedFill == null) ? null : _changeFillColor,
child: const Text('change fill-color'),
),
TextButton(
onPressed: (_selectedFill == null)
? null
: _changeFillOutlineColor,
child: const Text('change fill-outline-color'),
),
TextButton(
onPressed: (_selectedFill == null)
? null
: _changeFillPattern,
child: const Text('change fill-pattern'),
),
TextButton(
onPressed:
(_selectedFill == null) ? null : _changePosition,
child: const Text('change position'),
),
TextButton(
onPressed:
(_selectedFill == null) ? null : _changeDraggable,
child: const Text('toggle draggable'),
),
],
),
],
)
],
child: MaplibreMap(
onMapCreated: _onMapCreated,
onStyleLoadedCallback: _onStyleLoaded,
initialCameraPosition: const CameraPosition(
target: LatLng(-33.852, 151.211),
zoom: 7.0,
),
),
),
Expand Down
Loading

0 comments on commit adf9ab9

Please sign in to comment.