Reputation: 12461
return Scaffold(
appBar:
PreferredSize(
preferredSize: Size.fromHeight(120),// change appbar size
child:AppBar(
backgroundColor: Color.fromARGB(255,254,202,8),
leading:RawMaterialButton(
constraints: BoxConstraints(),
padding: EdgeInsets.all(0),
child: Image.asset("assets/img/home.png",height:110), // set height as 110
),
title:Text("mytitle");
I changed appbar height by preferredSize
and set leading Image height as 100
AppBar height is changed but leading icon size is not changed.
And text too.
How can I change leading and text size according to appbar size??
Upvotes: 1
Views: 311
Reputation: 7119
It is not possible to change the leading
size in the AppBar
, but a workaround is to use a Row
containing the image and the title and set this row as the flexibleSpace
of the AppBar
:
AppBar(
backgroundColor: Color.fromARGB(255, 254, 202, 8),
flexibleSpace: Row(
children: <Widget>[
RawMaterialButton(
constraints: BoxConstraints(),
padding: EdgeInsets.all(0),
child: Image.asset(
"assets/img/home.png",
height: 110,
),
),
Text("mytitle"),
],
),
),
Upvotes: 1