-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
Labels
f: material designflutter/packages/flutter/material repository.flutter/packages/flutter/material repository.found in release: 3.27Found to occur in 3.27Found to occur in 3.27frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versionteam-designOwned by Design Languages teamOwned by Design Languages team
Description
Steps to reproduce
Currently NavigationBar label text style can only be customized through NavigationBarTheme
Expected results
Can customize from NavigationBar (widget-level)
Actual results
Cannot customize on the widget level
Code sample
Code sample
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
const TextStyle selectedTextStyle =
TextStyle(fontSize: 15, color: Color(0xFF00FF00));
const TextStyle unselectedTextStyle =
TextStyle(fontSize: 15, color: Color(0xFF0000FF));
const TextStyle disabledTextStyle =
TextStyle(fontSize: 16, color: Color(0xFFFF0000));
return MaterialApp(
debugShowCheckedModeBanner: false,
theme: ThemeData(
navigationBarTheme: NavigationBarThemeData(
labelTextStyle: WidgetStatePropertyAll(
TextStyle(
fontSize: 14,
fontWeight: FontWeight.bold,
color: Theme.of(context).colorScheme.primary,
),
),
)),
home: Scaffold(
appBar: AppBar(
title: const Text('NavigationBar Sample'),
),
bottomNavigationBar: NavigationBar(
labelTextStyle: const WidgetStateProperty<TextStyle?>.fromMap(
<WidgetStatesConstraint, TextStyle?>{
WidgetState.disabled: disabledTextStyle,
WidgetState.selected: selectedTextStyle,
WidgetState.any: unselectedTextStyle,
},
),
onDestinationSelected: null,
destinations: const <Widget>[
NavigationDestination(
icon: Icon(Icons.home),
label: 'Home',
),
NavigationDestination(
icon: Icon(Icons.favorite_rounded),
label: 'Favorites',
),
NavigationDestination(
enabled: false,
icon: Icon(Icons.settings),
label: 'Settings',
),
],
),
),
);
}
}
Screenshots or Video
Screenshots / Video demonstration
[Upload media here]
Logs
Logs
[Paste your logs here]Flutter Doctor output
Doctor output
[Paste your output here]Metadata
Metadata
Assignees
Labels
f: material designflutter/packages/flutter/material repository.flutter/packages/flutter/material repository.found in release: 3.27Found to occur in 3.27Found to occur in 3.27frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versionteam-designOwned by Design Languages teamOwned by Design Languages team
Type
Projects
Status
Done (PR merged)