Skip to content

style: formatted and fixed code to resolve linting issues #248

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

Merged
merged 1 commit into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 16 additions & 13 deletions geocoding/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@ import 'package:flutter/material.dart';
import 'package:geocoding/geocoding.dart';

void main() {
runApp(_GeocodingExample());
runApp(const _GeocodingExample());
}

/// Example [Widget] showing the use of the Geocode plugin
class GeocodeWidget extends StatefulWidget {
/// Constructs the [GeocodeWidget] class
const GeocodeWidget({Key? key}) : super(key: key);

@override
_GeocodeWidgetState createState() => _GeocodeWidgetState();
State<GeocodeWidget> createState() => _GeocodeWidgetState();
}

class _GeocodeWidgetState extends State<GeocodeWidget> {
Expand Down Expand Up @@ -45,21 +48,21 @@ class _GeocodeWidgetState extends State<GeocodeWidget> {
autocorrect: false,
controller: _latitudeController,
style: Theme.of(context).textTheme.bodyMedium,
decoration: InputDecoration(
decoration: const InputDecoration(
hintText: 'Latitude',
),
keyboardType: TextInputType.number,
),
),
SizedBox(
const SizedBox(
width: 20,
),
Expanded(
child: TextField(
autocorrect: false,
controller: _longitudeController,
style: Theme.of(context).textTheme.bodyMedium,
decoration: InputDecoration(
decoration: const InputDecoration(
hintText: 'Longitude',
),
keyboardType: TextInputType.number,
Expand All @@ -72,7 +75,7 @@ class _GeocodeWidgetState extends State<GeocodeWidget> {
),
Center(
child: ElevatedButton(
child: Text('Look up address'),
child: const Text('Look up address'),
onPressed: () {
final latitude = double.parse(_latitudeController.text);
final longitude = double.parse(_longitudeController.text);
Expand All @@ -97,7 +100,7 @@ class _GeocodeWidgetState extends State<GeocodeWidget> {
autocorrect: false,
controller: _addressController,
style: Theme.of(context).textTheme.bodyMedium,
decoration: InputDecoration(
decoration: const InputDecoration(
hintText: 'Address',
),
keyboardType: TextInputType.text,
Expand All @@ -107,7 +110,7 @@ class _GeocodeWidgetState extends State<GeocodeWidget> {
),
Center(
child: ElevatedButton(
child: Text('Look up location'),
child: const Text('Look up location'),
onPressed: () {
locationFromAddress(_addressController.text)
.then((locations) {
Expand All @@ -126,7 +129,7 @@ class _GeocodeWidgetState extends State<GeocodeWidget> {
),
Center(
child: ElevatedButton(
child: Text('is Present'),
child: const Text('is Present'),
onPressed: () {
isPresent().then((isPresent) {
var output = isPresent ? 'Is present' : 'Is not present';
Expand All @@ -141,7 +144,7 @@ class _GeocodeWidgetState extends State<GeocodeWidget> {
),
Center(
child: ElevatedButton(
child: Text('Set locale en_US'),
child: const Text('Set locale en_US'),
onPressed: () {
setLocaleIdentifier("en_US").then((_) {
setState(() {});
Expand All @@ -152,7 +155,7 @@ class _GeocodeWidgetState extends State<GeocodeWidget> {
),
Center(
child: ElevatedButton(
child: Text('Set locale nl_NL'),
child: const Text('Set locale nl_NL'),
onPressed: () {
setLocaleIdentifier("nl_NL").then((_) {
setState(() {});
Expand All @@ -163,7 +166,7 @@ class _GeocodeWidgetState extends State<GeocodeWidget> {
),
Expanded(
child: SingleChildScrollView(
child: Container(
child: SizedBox(
width: MediaQuery.of(context).size.width,
child: Text(_output),
),
Expand All @@ -187,7 +190,7 @@ class _GeocodingExample extends StatelessWidget {
pages: [
ExamplePage(
Icons.pin_drop,
(BuildContext context) => GeocodeWidget(),
(BuildContext context) => const GeocodeWidget(),
),
]);
}
Expand Down
19 changes: 11 additions & 8 deletions geocoding_android/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ class BaseflowPluginExample extends StatelessWidget {
final MaterialColor themeMaterialColor =
createMaterialColor(const Color.fromRGBO(48, 49, 60, 1));

/// Constructs the [BaseflowPluginExample] class
BaseflowPluginExample({Key? key}) : super(key: key);

@override
Widget build(BuildContext context) {
final ThemeData theme = ThemeData();
Expand All @@ -22,7 +25,7 @@ class BaseflowPluginExample extends StatelessWidget {
colorScheme: theme.colorScheme.copyWith(
secondary: Colors.white60,
primary: createMaterialColor(const Color.fromRGBO(48, 49, 60, 1)),
background: const Color.fromRGBO(48, 49, 60, 0.8),
surface: const Color.fromRGBO(48, 49, 60, 0.8),
),
bottomAppBarTheme: theme.bottomAppBarTheme.copyWith(
color: const Color.fromRGBO(57, 58, 71, 1),
Expand All @@ -34,7 +37,7 @@ class BaseflowPluginExample extends StatelessWidget {
textTheme: ButtonTextTheme.primary,
),
hintColor: themeMaterialColor.shade500,
textTheme: TextTheme(
textTheme: const TextTheme(
bodyLarge: TextStyle(
color: Colors.white,
fontSize: 16,
Expand All @@ -52,12 +55,12 @@ class BaseflowPluginExample extends StatelessWidget {
),
),
visualDensity: VisualDensity.adaptivePlatformDensity,
inputDecorationTheme: InputDecorationTheme(
fillColor: const Color.fromRGBO(37, 37, 37, 1),
inputDecorationTheme: const InputDecorationTheme(
fillColor: Color.fromRGBO(37, 37, 37, 1),
filled: true,
),
),
home: AppHome(title: 'Baseflow $pluginName example app'),
home: const AppHome(title: 'Baseflow $pluginName example app'),
);
}

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

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

@override
_AppHomeState createState() => _AppHomeState();
State<AppHome> createState() => _AppHomeState();
}

class _AppHomeState extends State<AppHome> {
Expand Down Expand Up @@ -150,7 +153,7 @@ class _AppHomeState extends State<AppHome> {

void _animateToPage(int page) {
_pageController.animateToPage(page,
duration: Duration(milliseconds: 200), curve: Curves.linear);
duration: const Duration(milliseconds: 200), curve: Curves.linear);
}

Color _bottomAppBarIconColor(int page) {
Expand Down
31 changes: 17 additions & 14 deletions geocoding_android/example/lib/plugin_example/geocode_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@ import '../template/globals.dart';

/// Example [Widget] showing the use of the Geocode plugin
class GeocodeWidget extends StatefulWidget {
/// Constructs the [GeocodeWidget] class
const GeocodeWidget({Key? key}) : super(key: key);

@override
_GeocodeWidgetState createState() => _GeocodeWidgetState();
State<GeocodeWidget> createState() => _GeocodeWidgetState();
}

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

GeocodingAndroid _geocodingAndroid = GeocodingAndroid();
final GeocodingAndroid _geocodingAndroid = GeocodingAndroid();

@override
void initState() {
Expand Down Expand Up @@ -44,21 +47,21 @@ class _GeocodeWidgetState extends State<GeocodeWidget> {
autocorrect: false,
controller: _latitudeController,
style: Theme.of(context).textTheme.bodyMedium,
decoration: InputDecoration(
decoration: const InputDecoration(
hintText: 'Latitude',
),
keyboardType: TextInputType.number,
),
),
SizedBox(
const SizedBox(
width: 20,
),
Expanded(
child: TextField(
autocorrect: false,
controller: _longitudeController,
style: Theme.of(context).textTheme.bodyMedium,
decoration: InputDecoration(
decoration: const InputDecoration(
hintText: 'Longitude',
),
keyboardType: TextInputType.number,
Expand All @@ -71,7 +74,7 @@ class _GeocodeWidgetState extends State<GeocodeWidget> {
),
Center(
child: ElevatedButton(
child: Text('Look up address'),
child: const Text('Look up address'),
onPressed: () {
final latitude = double.parse(_latitudeController.text);
final longitude = double.parse(_longitudeController.text);
Expand All @@ -97,7 +100,7 @@ class _GeocodeWidgetState extends State<GeocodeWidget> {
autocorrect: false,
controller: _addressController,
style: Theme.of(context).textTheme.bodyMedium,
decoration: InputDecoration(
decoration: const InputDecoration(
hintText: 'Address',
),
keyboardType: TextInputType.text,
Expand All @@ -107,7 +110,7 @@ class _GeocodeWidgetState extends State<GeocodeWidget> {
),
Center(
child: ElevatedButton(
child: Text('Look up address'),
child: const Text('Look up address'),
onPressed: () {
_geocodingAndroid
.placemarkFromAddress(_addressController.text)
Expand All @@ -130,7 +133,7 @@ class _GeocodeWidgetState extends State<GeocodeWidget> {
autocorrect: false,
controller: _addressController,
style: Theme.of(context).textTheme.bodyMedium,
decoration: InputDecoration(
decoration: const InputDecoration(
hintText: 'Address',
),
keyboardType: TextInputType.text,
Expand All @@ -140,7 +143,7 @@ class _GeocodeWidgetState extends State<GeocodeWidget> {
),
Center(
child: ElevatedButton(
child: Text('Look up location'),
child: const Text('Look up location'),
onPressed: () {
_geocodingAndroid
.locationFromAddress(_addressController.text)
Expand All @@ -161,7 +164,7 @@ class _GeocodeWidgetState extends State<GeocodeWidget> {
),
Center(
child: ElevatedButton(
child: Text('Is present'),
child: const Text('Is present'),
onPressed: () {
_geocodingAndroid.isPresent().then((isPresent) {
var output = isPresent
Expand All @@ -178,7 +181,7 @@ class _GeocodeWidgetState extends State<GeocodeWidget> {
),
Center(
child: ElevatedButton(
child: Text('Set locale en_US'),
child: const Text('Set locale en_US'),
onPressed: () {
_geocodingAndroid.setLocaleIdentifier("en_US").then((_) {
//locale set
Expand All @@ -189,7 +192,7 @@ class _GeocodeWidgetState extends State<GeocodeWidget> {
),
Center(
child: ElevatedButton(
child: Text('Set locale nl_NL'),
child: const Text('Set locale nl_NL'),
onPressed: () {
_geocodingAndroid.setLocaleIdentifier("nl_NL").then((_) {
//locale set
Expand All @@ -200,7 +203,7 @@ class _GeocodeWidgetState extends State<GeocodeWidget> {
),
Expanded(
child: SingleChildScrollView(
child: Container(
child: SizedBox(
width: MediaQuery.of(context).size.width,
child: Text(_output),
),
Expand Down
4 changes: 2 additions & 2 deletions geocoding_android/example/lib/template/globals.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ final List<IconData> icons = [

/// Returns a [List] with [Widget]s to construct pages in the [AppBar].
final List<Widget> pages = [
GeocodeWidget(),
InfoPage(),
const GeocodeWidget(),
const InfoPage(),
];
3 changes: 3 additions & 0 deletions geocoding_android/example/lib/template/info_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ import 'globals.dart';

/// [StatelessWidget] displaying information about Baseflow
class InfoPage extends StatelessWidget {
/// Constructs the [InfoPage] class
const InfoPage({Key? key}) : super(key: key);

@override
Widget build(BuildContext context) {
return SizedBox.expand(
Expand Down
Loading