Taha Tesser
7cef966147
Fix NavigationDrawer
selected item has wrong icon color ( #129625 )
...
fixes [NavigationDrawer selected item has wrong icon color [Material3 spec]](https://github.com/flutter/flutter/issues/129572 )
### Description
This PR fixes a mistake in the `NavigationDrawer` defaults, where generated token value returns a `null`.
This issue can be detected when you want to customize the selected icon color for `NavigationDrawerDestination` using a custom color scheme.
### Code sample
<details>
<summary>expanded to view the code sample</summary>
```dart
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
themeMode: ThemeMode.light,
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.blue).copyWith(
onSecondaryContainer: Colors.red,
),
useMaterial3: true,
),
home: const Example(),
);
}
}
class Example extends StatelessWidget {
const Example({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('NavigationDrawer Sample'),
),
drawer: const NavigationDrawer(
children: <Widget>[
NavigationDrawerDestination(
icon: Icon(Icons.favorite_outline_rounded),
label: Text('Favorite'),
selectedIcon: Icon(Icons.favorite_rounded),
),
NavigationDrawerDestination(
icon: Icon(Icons.favorite_outline_rounded),
label: Text('Favorite'),
),
],
),
);
}
}
```
</details>
### Before
<img width="1053" alt="Screenshot 2023-06-27 at 13 24 38" src="https://github.com/flutter/flutter/assets/48603081/18c13a73-688f-4586-bb60-bddef45d173f ">
### After
<img width="1053" alt="Screenshot 2023-06-27 at 13 24 25" src="https://github.com/flutter/flutter/assets/48603081/8a1427c6-517f-424a-b0bd-24bad7c5fbb0 ">
2023-06-30 08:58:14 +00:00
Taha Tesser
32fde139bc
Fix Material 3 Scrollable TabBar
( #125974 )
...
fix https://github.com/flutter/flutter/issues/117722
### Description
1. Fix the divider doesn't stretch to take all the available width in the scrollable tab bar in M3
2. Add `dividerHeight` property.
3. Update the default tab alignment for the scrollable tab bar to match the specs (this is backward compatible for M2 with the new `tabAlignment` property).
### Bug (default tab alignment)

### Fix (default tab alignment)

### Code sample
<details>
<summary>code sample</summary>
```dart
import 'package:flutter/material.dart';
/// Flutter code sample for [TabBar].
void main() => runApp(const TabBarApp());
class TabBarApp extends StatelessWidget {
const TabBarApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(
// tabBarTheme: const TabBarTheme(tabAlignment: TabAlignment.start),
useMaterial3: true,
),
home: const TabBarExample(),
);
}
}
class TabBarExample extends StatefulWidget {
const TabBarExample({super.key});
@override
State<TabBarExample> createState() => _TabBarExampleState();
}
class _TabBarExampleState extends State<TabBarExample> {
bool rtl = false;
@override
Widget build(BuildContext context) {
return DefaultTabController(
initialIndex: 1,
length: 3,
child: Directionality(
textDirection: rtl ? TextDirection.rtl : TextDirection.ltr,
child: Scaffold(
appBar: AppBar(
title: const Text('TabBar Sample'),
),
body: const Column(
children: <Widget>[
Text('Scrollable-TabAlignment.start'),
TabBar(
isScrollable: true,
tabAlignment: TabAlignment.start,
tabs: <Widget>[
Tab(
icon: Icon(Icons.cloud_outlined),
),
Tab(
icon: Icon(Icons.beach_access_sharp),
),
Tab(
icon: Icon(Icons.brightness_5_sharp),
),
],
),
Text('Scrollable-TabAlignment.startOffset'),
TabBar(
isScrollable: true,
tabAlignment: TabAlignment.startOffset,
tabs: <Widget>[
Tab(
icon: Icon(Icons.cloud_outlined),
),
Tab(
icon: Icon(Icons.beach_access_sharp),
),
Tab(
icon: Icon(Icons.brightness_5_sharp),
),
],
),
Text('Scrollable-TabAlignment.center'),
TabBar(
isScrollable: true,
tabAlignment: TabAlignment.center,
tabs: <Widget>[
Tab(
icon: Icon(Icons.cloud_outlined),
),
Tab(
icon: Icon(Icons.beach_access_sharp),
),
Tab(
icon: Icon(Icons.brightness_5_sharp),
),
],
),
Spacer(),
Text('Non-scrollable-TabAlignment.fill'),
TabBar(
tabAlignment: TabAlignment.fill,
tabs: <Widget>[
Tab(
icon: Icon(Icons.cloud_outlined),
),
Tab(
icon: Icon(Icons.beach_access_sharp),
),
Tab(
icon: Icon(Icons.brightness_5_sharp),
),
],
),
Text('Non-scrollable-TabAlignment.center'),
TabBar(
tabAlignment: TabAlignment.center,
tabs: <Widget>[
Tab(
icon: Icon(Icons.cloud_outlined),
),
Tab(
icon: Icon(Icons.beach_access_sharp),
),
Tab(
icon: Icon(Icons.brightness_5_sharp),
),
],
),
Spacer(),
],
),
floatingActionButton: FloatingActionButton.extended(
onPressed: () {
setState(() {
rtl = !rtl;
});
},
label: const Text('Switch Direction'),
icon: const Icon(Icons.swap_horiz),
),
),
),
);
}
}
```
</details>

2023-06-22 17:30:46 +00:00
Taha Tesser
ca5aa2329a
Update ListTile
text defaults to use ColorScheme
( #128581 )
...
fixes https://github.com/flutter/flutter/issues/128569
<details>
<summary>code sample</summary>
```dart
import 'package:flutter/material.dart';
void main() {
runApp(const ListTileApp());
}
class ListTileApp extends StatelessWidget {
const ListTileApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
useMaterial3: true,
colorScheme: ColorScheme.fromSeed(seedColor: Colors.red).copyWith(
onSurface: Colors.yellow,
onSurfaceVariant: Colors.green,
),
),
home: const Scaffold(
body: Center(
child: ListTile(
title: Text('title'),
subtitle: Text('subtitle'),
),
),
),
);
}
}
```
</details>
# Description
M3 ListTile couldn't be customized using `ColorScheme` colors.
- This PR updates the list tile text defaults to `ColorScheme` text color tokens.
- Improved the `ListTile` template to use the token group.
- Update docs and tests.
```dart
colorScheme: ColorScheme.fromSeed(seedColor: Colors.red).copyWith(
onSurface: Colors.yellow,
onSurfaceVariant: Colors.green,
),
```
### Before

### After

2023-06-12 14:52:06 +00:00
Pierre-Louis
66cda5917d
Improve defaults generation with logging, stats, and token validation ( #128244 )
...
## Description
This improves defaults generation with logging, stats, and token validation.
This PR includes these changes:
* introduce `TokenLogger`, with a verbose mode
* prints versions and tokens usage to the console
* outputs `generated/used_tokens.csv`, a list of all used tokens, for use by Google
* find token files in `data` automatically
* hide tokens `Map`
* tokens can be obtained using existing resolvers (e.g. `color`, `shape`), or directly through `getToken`.
* tokens can be checked for existence with `tokenAvailable`
* remove version from template, since the tokens are aggregated and multiple versions are possible (as is the case currently), it does not make sense to attribute a single version
* improve documentation
## Related Issues
- Fixes https://github.com/flutter/flutter/issues/122602
## Tests
- Added tests for `TokenLogger`
- Regenerated tokens, no-op except version removal
## Future work
A future PR should replace or remove the following invalid tokens usages
<img width="578" alt="image" src="https://github.com/flutter/flutter/assets/6655696/b6f9e5a7-523f-4f72-94f9-1b0bf4cc9f00 ">
2023-06-09 11:28:18 +00:00