Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(example): responsive design #421

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
Open
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
OpenGL ES 3.0.
* Renamed the method channel to `plugins.flutter.io/maplibre_gl_*` in all packages.

### Other changes
* Updated example app

## 0.19.0

This is the first version where all packages are published on pub.dev. Please
Expand Down
16 changes: 0 additions & 16 deletions example/README.md

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,17 @@ import 'dart:math';

import 'package:flutter/material.dart';
import 'package:maplibre_gl/maplibre_gl.dart';
import 'package:maplibre_gl_example/main.dart';
import 'package:maplibre_gl_example/common/example_scaffold.dart';

import 'page.dart';

class PlaceCirclePage extends ExamplePage {
const PlaceCirclePage({super.key})
: super(const Icon(Icons.check_circle), 'Place circle');

@override
Widget build(BuildContext context) {
return const PlaceCircleBody();
}
}

class PlaceCircleBody extends StatefulWidget {
const PlaceCircleBody({super.key});
class AnnotationCirclePage extends StatefulWidget {
const AnnotationCirclePage({super.key});

@override
State<StatefulWidget> createState() => PlaceCircleBodyState();
State<StatefulWidget> createState() => _AnnotationCirclePageState();
}

class PlaceCircleBodyState extends State<PlaceCircleBody> {
PlaceCircleBodyState();

class _AnnotationCirclePageState extends State<AnnotationCirclePage> {
static const LatLng center = LatLng(-33.86711, 151.1947171);

MaplibreMapController? controller;
Expand Down Expand Up @@ -188,14 +176,76 @@ class PlaceCircleBodyState extends State<PlaceCircleBody> {

@override
Widget build(BuildContext context) {
return Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
Center(
child: SizedBox(
width: 300.0,
height: 200.0,
return ExampleScaffold(
page: ExamplePage.annotationCircle,
body: Column(
children: <Widget>[
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: MaplibreMap(
onMapCreated: _onMapCreated,
initialCameraPosition: const CameraPosition(
Expand All @@ -204,96 +254,8 @@ class PlaceCircleBodyState extends State<PlaceCircleBody> {
),
),
),
),
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'),
),
],
),
],
)
],
),
),
),
],
],
),
);
}
}
Loading