Created
February 6, 2023 12:08
-
-
Save esouthren/89671f7724ef07fd4b248ff7cf344f9a to your computer and use it in GitHub Desktop.
list tile icon buttons
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright 2014 The Flutter Authors. All rights reserved. | |
// Use of this source code is governed by a BSD-style license that can be | |
// found in the LICENSE file. | |
// Flutter code sample for [TextFormField]. | |
import 'package:flutter/material.dart'; | |
void main() => runApp(const MyApp()); | |
class MyApp extends StatelessWidget { | |
const MyApp({super.key}); | |
static const String _title = 'Flutter Code Sample'; | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
theme: ThemeData( | |
useMaterial3: true, | |
iconButtonTheme: const IconButtonThemeData( | |
style: ButtonStyle( | |
foregroundColor: MaterialStatePropertyAll(Colors.red), | |
), | |
), | |
), | |
title: _title, | |
home: MyWidget(), | |
); | |
} | |
} | |
class MyWidget extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
body: Center( | |
child: ListTile( | |
title: const Text('hello world'), | |
// EXPECTED: blue icons. | |
// ACTUAL: red icons, from iconButtonTheme override above. | |
iconColor: Colors.blue, | |
trailing: IconButton( | |
icon: const Icon( | |
Icons.favorite, | |
), | |
onPressed: () {}, | |
), | |
leading: IconButton( | |
icon: const Icon( | |
Icons.favorite, | |
), | |
onPressed: () {}, | |
), | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment