Skip to content

Commit 28bf243

Browse files
authored
style: formatted and fixed code to resolve linting issues (#248)
1 parent 437ab6a commit 28bf243

File tree

9 files changed

+80
-59
lines changed

9 files changed

+80
-59
lines changed

geocoding/example/lib/main.dart

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,16 @@ import 'package:flutter/material.dart';
33
import 'package:geocoding/geocoding.dart';
44

55
void main() {
6-
runApp(_GeocodingExample());
6+
runApp(const _GeocodingExample());
77
}
88

99
/// Example [Widget] showing the use of the Geocode plugin
1010
class GeocodeWidget extends StatefulWidget {
11+
/// Constructs the [GeocodeWidget] class
12+
const GeocodeWidget({Key? key}) : super(key: key);
13+
1114
@override
12-
_GeocodeWidgetState createState() => _GeocodeWidgetState();
15+
State<GeocodeWidget> createState() => _GeocodeWidgetState();
1316
}
1417

1518
class _GeocodeWidgetState extends State<GeocodeWidget> {
@@ -45,21 +48,21 @@ class _GeocodeWidgetState extends State<GeocodeWidget> {
4548
autocorrect: false,
4649
controller: _latitudeController,
4750
style: Theme.of(context).textTheme.bodyMedium,
48-
decoration: InputDecoration(
51+
decoration: const InputDecoration(
4952
hintText: 'Latitude',
5053
),
5154
keyboardType: TextInputType.number,
5255
),
5356
),
54-
SizedBox(
57+
const SizedBox(
5558
width: 20,
5659
),
5760
Expanded(
5861
child: TextField(
5962
autocorrect: false,
6063
controller: _longitudeController,
6164
style: Theme.of(context).textTheme.bodyMedium,
62-
decoration: InputDecoration(
65+
decoration: const InputDecoration(
6366
hintText: 'Longitude',
6467
),
6568
keyboardType: TextInputType.number,
@@ -72,7 +75,7 @@ class _GeocodeWidgetState extends State<GeocodeWidget> {
7275
),
7376
Center(
7477
child: ElevatedButton(
75-
child: Text('Look up address'),
78+
child: const Text('Look up address'),
7679
onPressed: () {
7780
final latitude = double.parse(_latitudeController.text);
7881
final longitude = double.parse(_longitudeController.text);
@@ -97,7 +100,7 @@ class _GeocodeWidgetState extends State<GeocodeWidget> {
97100
autocorrect: false,
98101
controller: _addressController,
99102
style: Theme.of(context).textTheme.bodyMedium,
100-
decoration: InputDecoration(
103+
decoration: const InputDecoration(
101104
hintText: 'Address',
102105
),
103106
keyboardType: TextInputType.text,
@@ -107,7 +110,7 @@ class _GeocodeWidgetState extends State<GeocodeWidget> {
107110
),
108111
Center(
109112
child: ElevatedButton(
110-
child: Text('Look up location'),
113+
child: const Text('Look up location'),
111114
onPressed: () {
112115
locationFromAddress(_addressController.text)
113116
.then((locations) {
@@ -126,7 +129,7 @@ class _GeocodeWidgetState extends State<GeocodeWidget> {
126129
),
127130
Center(
128131
child: ElevatedButton(
129-
child: Text('is Present'),
132+
child: const Text('is Present'),
130133
onPressed: () {
131134
isPresent().then((isPresent) {
132135
var output = isPresent ? 'Is present' : 'Is not present';
@@ -141,7 +144,7 @@ class _GeocodeWidgetState extends State<GeocodeWidget> {
141144
),
142145
Center(
143146
child: ElevatedButton(
144-
child: Text('Set locale en_US'),
147+
child: const Text('Set locale en_US'),
145148
onPressed: () {
146149
setLocaleIdentifier("en_US").then((_) {
147150
setState(() {});
@@ -152,7 +155,7 @@ class _GeocodeWidgetState extends State<GeocodeWidget> {
152155
),
153156
Center(
154157
child: ElevatedButton(
155-
child: Text('Set locale nl_NL'),
158+
child: const Text('Set locale nl_NL'),
156159
onPressed: () {
157160
setLocaleIdentifier("nl_NL").then((_) {
158161
setState(() {});
@@ -163,7 +166,7 @@ class _GeocodeWidgetState extends State<GeocodeWidget> {
163166
),
164167
Expanded(
165168
child: SingleChildScrollView(
166-
child: Container(
169+
child: SizedBox(
167170
width: MediaQuery.of(context).size.width,
168171
child: Text(_output),
169172
),
@@ -187,7 +190,7 @@ class _GeocodingExample extends StatelessWidget {
187190
pages: [
188191
ExamplePage(
189192
Icons.pin_drop,
190-
(BuildContext context) => GeocodeWidget(),
193+
(BuildContext context) => const GeocodeWidget(),
191194
),
192195
]);
193196
}

geocoding_android/example/lib/main.dart

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ class BaseflowPluginExample extends StatelessWidget {
1212
final MaterialColor themeMaterialColor =
1313
createMaterialColor(const Color.fromRGBO(48, 49, 60, 1));
1414

15+
/// Constructs the [BaseflowPluginExample] class
16+
BaseflowPluginExample({Key? key}) : super(key: key);
17+
1518
@override
1619
Widget build(BuildContext context) {
1720
final ThemeData theme = ThemeData();
@@ -22,7 +25,7 @@ class BaseflowPluginExample extends StatelessWidget {
2225
colorScheme: theme.colorScheme.copyWith(
2326
secondary: Colors.white60,
2427
primary: createMaterialColor(const Color.fromRGBO(48, 49, 60, 1)),
25-
background: const Color.fromRGBO(48, 49, 60, 0.8),
28+
surface: const Color.fromRGBO(48, 49, 60, 0.8),
2629
),
2730
bottomAppBarTheme: theme.bottomAppBarTheme.copyWith(
2831
color: const Color.fromRGBO(57, 58, 71, 1),
@@ -34,7 +37,7 @@ class BaseflowPluginExample extends StatelessWidget {
3437
textTheme: ButtonTextTheme.primary,
3538
),
3639
hintColor: themeMaterialColor.shade500,
37-
textTheme: TextTheme(
40+
textTheme: const TextTheme(
3841
bodyLarge: TextStyle(
3942
color: Colors.white,
4043
fontSize: 16,
@@ -52,12 +55,12 @@ class BaseflowPluginExample extends StatelessWidget {
5255
),
5356
),
5457
visualDensity: VisualDensity.adaptivePlatformDensity,
55-
inputDecorationTheme: InputDecorationTheme(
56-
fillColor: const Color.fromRGBO(37, 37, 37, 1),
58+
inputDecorationTheme: const InputDecorationTheme(
59+
fillColor: Color.fromRGBO(37, 37, 37, 1),
5760
filled: true,
5861
),
5962
),
60-
home: AppHome(title: 'Baseflow $pluginName example app'),
63+
home: const AppHome(title: 'Baseflow $pluginName example app'),
6164
);
6265
}
6366

@@ -86,14 +89,14 @@ class BaseflowPluginExample extends StatelessWidget {
8689
/// A Flutter example demonstrating how the [pluginName] plugin could be used
8790
class AppHome extends StatefulWidget {
8891
/// Constructs the [AppHome] class
89-
AppHome({required this.title});
92+
const AppHome({Key? key, required this.title}) : super(key: key);
9093

9194
/// The [title] of the application, which is shown in the application's
9295
/// title bar.
9396
final String title;
9497

9598
@override
96-
_AppHomeState createState() => _AppHomeState();
99+
State<AppHome> createState() => _AppHomeState();
97100
}
98101

99102
class _AppHomeState extends State<AppHome> {
@@ -150,7 +153,7 @@ class _AppHomeState extends State<AppHome> {
150153

151154
void _animateToPage(int page) {
152155
_pageController.animateToPage(page,
153-
duration: Duration(milliseconds: 200), curve: Curves.linear);
156+
duration: const Duration(milliseconds: 200), curve: Curves.linear);
154157
}
155158

156159
Color _bottomAppBarIconColor(int page) {

geocoding_android/example/lib/plugin_example/geocode_page.dart

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,11 @@ import '../template/globals.dart';
55

66
/// Example [Widget] showing the use of the Geocode plugin
77
class GeocodeWidget extends StatefulWidget {
8+
/// Constructs the [GeocodeWidget] class
9+
const GeocodeWidget({Key? key}) : super(key: key);
10+
811
@override
9-
_GeocodeWidgetState createState() => _GeocodeWidgetState();
12+
State<GeocodeWidget> createState() => _GeocodeWidgetState();
1013
}
1114

1215
class _GeocodeWidgetState extends State<GeocodeWidget> {
@@ -15,7 +18,7 @@ class _GeocodeWidgetState extends State<GeocodeWidget> {
1518
final TextEditingController _longitudeController = TextEditingController();
1619
String _output = '';
1720

18-
GeocodingAndroid _geocodingAndroid = GeocodingAndroid();
21+
final GeocodingAndroid _geocodingAndroid = GeocodingAndroid();
1922

2023
@override
2124
void initState() {
@@ -44,21 +47,21 @@ class _GeocodeWidgetState extends State<GeocodeWidget> {
4447
autocorrect: false,
4548
controller: _latitudeController,
4649
style: Theme.of(context).textTheme.bodyMedium,
47-
decoration: InputDecoration(
50+
decoration: const InputDecoration(
4851
hintText: 'Latitude',
4952
),
5053
keyboardType: TextInputType.number,
5154
),
5255
),
53-
SizedBox(
56+
const SizedBox(
5457
width: 20,
5558
),
5659
Expanded(
5760
child: TextField(
5861
autocorrect: false,
5962
controller: _longitudeController,
6063
style: Theme.of(context).textTheme.bodyMedium,
61-
decoration: InputDecoration(
64+
decoration: const InputDecoration(
6265
hintText: 'Longitude',
6366
),
6467
keyboardType: TextInputType.number,
@@ -71,7 +74,7 @@ class _GeocodeWidgetState extends State<GeocodeWidget> {
7174
),
7275
Center(
7376
child: ElevatedButton(
74-
child: Text('Look up address'),
77+
child: const Text('Look up address'),
7578
onPressed: () {
7679
final latitude = double.parse(_latitudeController.text);
7780
final longitude = double.parse(_longitudeController.text);
@@ -97,7 +100,7 @@ class _GeocodeWidgetState extends State<GeocodeWidget> {
97100
autocorrect: false,
98101
controller: _addressController,
99102
style: Theme.of(context).textTheme.bodyMedium,
100-
decoration: InputDecoration(
103+
decoration: const InputDecoration(
101104
hintText: 'Address',
102105
),
103106
keyboardType: TextInputType.text,
@@ -107,7 +110,7 @@ class _GeocodeWidgetState extends State<GeocodeWidget> {
107110
),
108111
Center(
109112
child: ElevatedButton(
110-
child: Text('Look up address'),
113+
child: const Text('Look up address'),
111114
onPressed: () {
112115
_geocodingAndroid
113116
.placemarkFromAddress(_addressController.text)
@@ -130,7 +133,7 @@ class _GeocodeWidgetState extends State<GeocodeWidget> {
130133
autocorrect: false,
131134
controller: _addressController,
132135
style: Theme.of(context).textTheme.bodyMedium,
133-
decoration: InputDecoration(
136+
decoration: const InputDecoration(
134137
hintText: 'Address',
135138
),
136139
keyboardType: TextInputType.text,
@@ -140,7 +143,7 @@ class _GeocodeWidgetState extends State<GeocodeWidget> {
140143
),
141144
Center(
142145
child: ElevatedButton(
143-
child: Text('Look up location'),
146+
child: const Text('Look up location'),
144147
onPressed: () {
145148
_geocodingAndroid
146149
.locationFromAddress(_addressController.text)
@@ -161,7 +164,7 @@ class _GeocodeWidgetState extends State<GeocodeWidget> {
161164
),
162165
Center(
163166
child: ElevatedButton(
164-
child: Text('Is present'),
167+
child: const Text('Is present'),
165168
onPressed: () {
166169
_geocodingAndroid.isPresent().then((isPresent) {
167170
var output = isPresent
@@ -178,7 +181,7 @@ class _GeocodeWidgetState extends State<GeocodeWidget> {
178181
),
179182
Center(
180183
child: ElevatedButton(
181-
child: Text('Set locale en_US'),
184+
child: const Text('Set locale en_US'),
182185
onPressed: () {
183186
_geocodingAndroid.setLocaleIdentifier("en_US").then((_) {
184187
//locale set
@@ -189,7 +192,7 @@ class _GeocodeWidgetState extends State<GeocodeWidget> {
189192
),
190193
Center(
191194
child: ElevatedButton(
192-
child: Text('Set locale nl_NL'),
195+
child: const Text('Set locale nl_NL'),
193196
onPressed: () {
194197
_geocodingAndroid.setLocaleIdentifier("nl_NL").then((_) {
195198
//locale set
@@ -200,7 +203,7 @@ class _GeocodeWidgetState extends State<GeocodeWidget> {
200203
),
201204
Expanded(
202205
child: SingleChildScrollView(
203-
child: Container(
206+
child: SizedBox(
204207
width: MediaQuery.of(context).size.width,
205208
child: Text(_output),
206209
),

geocoding_android/example/lib/template/globals.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,6 @@ final List<IconData> icons = [
3232

3333
/// Returns a [List] with [Widget]s to construct pages in the [AppBar].
3434
final List<Widget> pages = [
35-
GeocodeWidget(),
36-
InfoPage(),
35+
const GeocodeWidget(),
36+
const InfoPage(),
3737
];

geocoding_android/example/lib/template/info_page.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ import 'globals.dart';
55

66
/// [StatelessWidget] displaying information about Baseflow
77
class InfoPage extends StatelessWidget {
8+
/// Constructs the [InfoPage] class
9+
const InfoPage({Key? key}) : super(key: key);
10+
811
@override
912
Widget build(BuildContext context) {
1013
return SizedBox.expand(

0 commit comments

Comments
 (0)