without Hero
with Hero
Positioned(
bottom: 0,
height: 90,
width: MediaQuery.of(context).size.width,
child: Container(
padding: EdgeInsets.fromLTRB(10, 0, 10, 10),
child: Hero(
tag: 'navbar',
child: NavBar(choosedicon: 1,)
),
),
)
Also, Hero can put into the NavBar Class, can change the code like this:
Positioned(
bottom: 0,
height: 90,
width: MediaQuery.of(context).size.width,
child: Container(
padding: EdgeInsets.fromLTRB(10, 0, 10, 10),
child: NavBar(choosedicon: 0,),
),
)
class NavBar extends StatelessWidget {
const NavBar({
Key? key,
required this.choosedicon
}) : super(key: key);
final int choosedicon;
@override
Widget build(BuildContext context) {
return Hero(
tag: 'navbar',
child: Container(
Hero has yellow underline? use Material & InkWell to GestureDetector
@override
Widget build(BuildContext context) {
double iconPaddingTop = 10;
return Material(
child: Row(
children: [
Expanded(
沒有留言:
發佈留言