mirror of
https://github.com/flutter/samples.git
synced 2025-11-08 13:58:47 +00:00
Enable Material 3 on place_tracker (#1621)
This commit is contained in:
@@ -93,7 +93,7 @@ class _PlaceMapState extends State<PlaceMap> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
_watchMapConfigurationChanges();
|
_watchMapConfigurationChanges();
|
||||||
var state = Provider.of<AppState>(context);
|
var state = Provider.of<AppState>(context, listen: true);
|
||||||
return Builder(builder: (context) {
|
return Builder(builder: (context) {
|
||||||
// We need this additional builder here so that we can pass its context to
|
// We need this additional builder here so that we can pass its context to
|
||||||
// _AddPlaceButtonBar's onSavePressed callback. This callback shows a
|
// _AddPlaceButtonBar's onSavePressed callback. This callback shows a
|
||||||
@@ -489,9 +489,9 @@ class _CategoryButtonBar extends StatelessWidget {
|
|||||||
child: ButtonBar(
|
child: ButtonBar(
|
||||||
alignment: MainAxisAlignment.center,
|
alignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
ElevatedButton(
|
FilledButton(
|
||||||
style: ElevatedButton.styleFrom(
|
style: FilledButton.styleFrom(
|
||||||
foregroundColor:
|
backgroundColor:
|
||||||
selectedPlaceCategory == PlaceCategory.favorite
|
selectedPlaceCategory == PlaceCategory.favorite
|
||||||
? Colors.green[700]
|
? Colors.green[700]
|
||||||
: Colors.lightGreen),
|
: Colors.lightGreen),
|
||||||
@@ -501,9 +501,9 @@ class _CategoryButtonBar extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
onPressed: () => onChanged(PlaceCategory.favorite),
|
onPressed: () => onChanged(PlaceCategory.favorite),
|
||||||
),
|
),
|
||||||
ElevatedButton(
|
FilledButton(
|
||||||
style: ElevatedButton.styleFrom(
|
style: FilledButton.styleFrom(
|
||||||
foregroundColor:
|
backgroundColor:
|
||||||
selectedPlaceCategory == PlaceCategory.visited
|
selectedPlaceCategory == PlaceCategory.visited
|
||||||
? Colors.green[700]
|
? Colors.green[700]
|
||||||
: Colors.lightGreen),
|
: Colors.lightGreen),
|
||||||
@@ -513,9 +513,9 @@ class _CategoryButtonBar extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
onPressed: () => onChanged(PlaceCategory.visited),
|
onPressed: () => onChanged(PlaceCategory.visited),
|
||||||
),
|
),
|
||||||
ElevatedButton(
|
FilledButton(
|
||||||
style: ElevatedButton.styleFrom(
|
style: FilledButton.styleFrom(
|
||||||
foregroundColor:
|
backgroundColor:
|
||||||
selectedPlaceCategory == PlaceCategory.wantToGo
|
selectedPlaceCategory == PlaceCategory.wantToGo
|
||||||
? Colors.green[700]
|
? Colors.green[700]
|
||||||
: Colors.lightGreen),
|
: Colors.lightGreen),
|
||||||
@@ -556,7 +556,6 @@ class _MapFabs extends StatelessWidget {
|
|||||||
heroTag: 'add_place_button',
|
heroTag: 'add_place_button',
|
||||||
onPressed: onAddPlacePressed,
|
onPressed: onAddPlacePressed,
|
||||||
materialTapTargetSize: MaterialTapTargetSize.padded,
|
materialTapTargetSize: MaterialTapTargetSize.padded,
|
||||||
backgroundColor: Colors.green,
|
|
||||||
child: const Icon(Icons.add_location, size: 36.0),
|
child: const Icon(Icons.add_location, size: 36.0),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 12.0),
|
const SizedBox(height: 12.0),
|
||||||
@@ -565,7 +564,6 @@ class _MapFabs extends StatelessWidget {
|
|||||||
onPressed: onToggleMapTypePressed,
|
onPressed: onToggleMapTypePressed,
|
||||||
materialTapTargetSize: MaterialTapTargetSize.padded,
|
materialTapTargetSize: MaterialTapTargetSize.padded,
|
||||||
mini: true,
|
mini: true,
|
||||||
backgroundColor: Colors.green,
|
|
||||||
child: const Icon(Icons.layers, size: 28.0),
|
child: const Icon(Icons.layers, size: 28.0),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -24,6 +24,18 @@ class PlaceTrackerApp extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return MaterialApp.router(
|
return MaterialApp.router(
|
||||||
|
theme: ThemeData(
|
||||||
|
useMaterial3: true,
|
||||||
|
colorSchemeSeed: Colors.green,
|
||||||
|
appBarTheme: AppBarTheme(
|
||||||
|
backgroundColor: Colors.green[700],
|
||||||
|
foregroundColor: Colors.white,
|
||||||
|
),
|
||||||
|
floatingActionButtonTheme: FloatingActionButtonThemeData(
|
||||||
|
backgroundColor: Colors.green[700],
|
||||||
|
foregroundColor: Colors.white,
|
||||||
|
),
|
||||||
|
),
|
||||||
routerConfig: GoRouter(routes: [
|
routerConfig: GoRouter(routes: [
|
||||||
GoRoute(
|
GoRoute(
|
||||||
path: '/',
|
path: '/',
|
||||||
@@ -65,7 +77,6 @@ class _PlaceTrackerHomePage extends StatelessWidget {
|
|||||||
Text('Place Tracker'),
|
Text('Place Tracker'),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
backgroundColor: Colors.green[700],
|
|
||||||
actions: [
|
actions: [
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.fromLTRB(0.0, 0.0, 16.0, 0.0),
|
padding: const EdgeInsets.fromLTRB(0.0, 0.0, 16.0, 0.0),
|
||||||
|
|||||||
Reference in New Issue
Block a user