mirror of
https://github.com/flutter/samples.git
synced 2025-11-10 14:58:34 +00:00
Upgrading samples to flutter_lints, part 1 of n (#804)
This commit is contained in:
@@ -37,7 +37,7 @@ class PlaceDetailsState extends State<PlaceDetails> {
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text('${_place.name}'),
|
||||
title: Text(_place.name),
|
||||
backgroundColor: Colors.green[700],
|
||||
actions: [
|
||||
Padding(
|
||||
|
||||
@@ -92,7 +92,7 @@ class _CategoryButton extends StatelessWidget {
|
||||
}
|
||||
|
||||
return Container(
|
||||
margin: EdgeInsets.symmetric(vertical: 12.0),
|
||||
margin: const EdgeInsets.symmetric(vertical: 12.0),
|
||||
decoration: BoxDecoration(
|
||||
border: Border(
|
||||
bottom: BorderSide(
|
||||
@@ -179,14 +179,14 @@ class _PlaceListTile extends StatelessWidget {
|
||||
}),
|
||||
),
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(top: 16.0),
|
||||
padding: const EdgeInsets.only(top: 16.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
place.name,
|
||||
textAlign: TextAlign.left,
|
||||
style: TextStyle(
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 20.0,
|
||||
),
|
||||
@@ -209,7 +209,7 @@ class _PlaceListTile extends StatelessWidget {
|
||||
maxLines: 4,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
SizedBox(height: 16.0),
|
||||
const SizedBox(height: 16.0),
|
||||
Divider(
|
||||
height: 2.0,
|
||||
color: Colors.grey[700],
|
||||
|
||||
@@ -206,7 +206,7 @@ class PlaceMapState extends State<PlaceMap> {
|
||||
// Show a confirmation snackbar that has an action to edit the new place.
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
duration: Duration(seconds: 3),
|
||||
duration: const Duration(seconds: 3),
|
||||
content:
|
||||
const Text('New place added.', style: TextStyle(fontSize: 16.0)),
|
||||
action: SnackBarAction(
|
||||
@@ -293,7 +293,7 @@ class PlaceMapState extends State<PlaceMap> {
|
||||
final newMarker = Marker(
|
||||
markerId: MarkerId(_lastMapPosition.toString()),
|
||||
position: _lastMapPosition,
|
||||
infoWindow: InfoWindow(title: 'New Place'),
|
||||
infoWindow: const InfoWindow(title: 'New Place'),
|
||||
draggable: true,
|
||||
icon: BitmapDescriptor.defaultMarkerWithHue(BitmapDescriptor.hueGreen),
|
||||
);
|
||||
@@ -433,12 +433,12 @@ class PlaceMapState extends State<PlaceMap> {
|
||||
switch (category) {
|
||||
case PlaceCategory.favorite:
|
||||
return BitmapDescriptor.fromAssetImage(
|
||||
createLocalImageConfiguration(context, size: Size.square(32)),
|
||||
createLocalImageConfiguration(context, size: const Size.square(32)),
|
||||
'assets/heart.png');
|
||||
break;
|
||||
case PlaceCategory.visited:
|
||||
return BitmapDescriptor.fromAssetImage(
|
||||
createLocalImageConfiguration(context, size: Size.square(32)),
|
||||
createLocalImageConfiguration(context, size: const Size.square(32)),
|
||||
'assets/visited.png');
|
||||
break;
|
||||
case PlaceCategory.wantToGo:
|
||||
@@ -598,7 +598,7 @@ class _MapFabs extends StatelessWidget {
|
||||
backgroundColor: Colors.green,
|
||||
child: const Icon(Icons.add_location, size: 36.0),
|
||||
),
|
||||
SizedBox(height: 12.0),
|
||||
const SizedBox(height: 12.0),
|
||||
FloatingActionButton(
|
||||
heroTag: 'toggle_map_type_button',
|
||||
onPressed: onToggleMapTypePressed,
|
||||
|
||||
@@ -19,7 +19,7 @@ enum PlaceTrackerViewType {
|
||||
class PlaceTrackerApp extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
return const MaterialApp(
|
||||
home: _PlaceTrackerHomePage(),
|
||||
);
|
||||
}
|
||||
@@ -46,7 +46,7 @@ class _PlaceTrackerHomePage extends StatelessWidget {
|
||||
backgroundColor: Colors.green[700],
|
||||
actions: [
|
||||
Padding(
|
||||
padding: EdgeInsets.fromLTRB(0.0, 0.0, 16.0, 0.0),
|
||||
padding: const EdgeInsets.fromLTRB(0.0, 0.0, 16.0, 0.0),
|
||||
child: IconButton(
|
||||
icon: Icon(
|
||||
state.viewType == PlaceTrackerViewType.map
|
||||
@@ -67,8 +67,8 @@ class _PlaceTrackerHomePage extends StatelessWidget {
|
||||
),
|
||||
body: IndexedStack(
|
||||
index: state.viewType == PlaceTrackerViewType.map ? 0 : 1,
|
||||
children: [
|
||||
PlaceMap(center: const LatLng(45.521563, -122.677433)),
|
||||
children: const [
|
||||
PlaceMap(center: LatLng(45.521563, -122.677433)),
|
||||
PlaceList()
|
||||
],
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user