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
|
||||
Widget build(BuildContext context) {
|
||||
_watchMapConfigurationChanges();
|
||||
var state = Provider.of<AppState>(context);
|
||||
var state = Provider.of<AppState>(context, listen: true);
|
||||
return Builder(builder: (context) {
|
||||
// We need this additional builder here so that we can pass its context to
|
||||
// _AddPlaceButtonBar's onSavePressed callback. This callback shows a
|
||||
@@ -489,9 +489,9 @@ class _CategoryButtonBar extends StatelessWidget {
|
||||
child: ButtonBar(
|
||||
alignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
foregroundColor:
|
||||
FilledButton(
|
||||
style: FilledButton.styleFrom(
|
||||
backgroundColor:
|
||||
selectedPlaceCategory == PlaceCategory.favorite
|
||||
? Colors.green[700]
|
||||
: Colors.lightGreen),
|
||||
@@ -501,9 +501,9 @@ class _CategoryButtonBar extends StatelessWidget {
|
||||
),
|
||||
onPressed: () => onChanged(PlaceCategory.favorite),
|
||||
),
|
||||
ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
foregroundColor:
|
||||
FilledButton(
|
||||
style: FilledButton.styleFrom(
|
||||
backgroundColor:
|
||||
selectedPlaceCategory == PlaceCategory.visited
|
||||
? Colors.green[700]
|
||||
: Colors.lightGreen),
|
||||
@@ -513,9 +513,9 @@ class _CategoryButtonBar extends StatelessWidget {
|
||||
),
|
||||
onPressed: () => onChanged(PlaceCategory.visited),
|
||||
),
|
||||
ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
foregroundColor:
|
||||
FilledButton(
|
||||
style: FilledButton.styleFrom(
|
||||
backgroundColor:
|
||||
selectedPlaceCategory == PlaceCategory.wantToGo
|
||||
? Colors.green[700]
|
||||
: Colors.lightGreen),
|
||||
@@ -556,7 +556,6 @@ class _MapFabs extends StatelessWidget {
|
||||
heroTag: 'add_place_button',
|
||||
onPressed: onAddPlacePressed,
|
||||
materialTapTargetSize: MaterialTapTargetSize.padded,
|
||||
backgroundColor: Colors.green,
|
||||
child: const Icon(Icons.add_location, size: 36.0),
|
||||
),
|
||||
const SizedBox(height: 12.0),
|
||||
@@ -565,7 +564,6 @@ class _MapFabs extends StatelessWidget {
|
||||
onPressed: onToggleMapTypePressed,
|
||||
materialTapTargetSize: MaterialTapTargetSize.padded,
|
||||
mini: true,
|
||||
backgroundColor: Colors.green,
|
||||
child: const Icon(Icons.layers, size: 28.0),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -24,6 +24,18 @@ class PlaceTrackerApp extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
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: [
|
||||
GoRoute(
|
||||
path: '/',
|
||||
@@ -65,7 +77,6 @@ class _PlaceTrackerHomePage extends StatelessWidget {
|
||||
Text('Place Tracker'),
|
||||
],
|
||||
),
|
||||
backgroundColor: Colors.green[700],
|
||||
actions: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(0.0, 0.0, 16.0, 0.0),
|
||||
|
||||
Reference in New Issue
Block a user