Fix `FlexibleSpaceBar` centered title position and title color (#140883)
fixes [Invisible SliverAppBar title in Material 3 light theme](https://github.com/flutter/flutter/issues/138296) fixes [`FlexibleSpaceBar` title is misaligned without the leading widget](https://github.com/flutter/flutter/issues/138608) Previous attempt https://github.com/flutter/flutter/pull/138611 --- ### Description - fixes the `FlexibleSpaceBar` centered title position when there is a leading widget. - fixes the `FlexibleSpaceBar` title color for Material 3. - Added documentation when using a long `FlexibleSpaceBar` title and update its test. - Improved documentation of default title padding. ### Code sample ### Code sample <details> <summary>expand 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 const MaterialApp( debugShowCheckedModeBanner: false, home: Example(), ); } } class Example extends StatelessWidget { const Example({super.key}); @override Widget build(BuildContext context) { return const Scaffold( body: SafeArea( child: CustomScrollView( slivers: <Widget>[ SliverAppBar( leading: Icon(Icons.favorite_rounded), flexibleSpace: FlexibleSpaceBar( title: ColoredBox( color: Color(0xffff0000), child: Text('SliverAppBar'), ), ), ), ], )), ); } } ``` </details> ### Before ![Screenshot 2024-01-03 at 18 02 25](https://github.com/flutter/flutter/assets/48603081/92ae1062-c78f-4005-8e28-85af617acd60) ### After ![Screenshot 2024-01-03 at 18 02 16](https://github.com/flutter/flutter/assets/48603081/2ef97108-9b50-44f7-a303-018ff1b28db6)
Showing
Please register or sign in to comment