Could I get some help? I wanna make an app bar like this one, and there was a package that does it but it is deprecated
CodePudding user response:
You can use a PreferredSizeWidget to build a custom app bar, giving a preferred app bar height.
You could use a Container
with a margin as a child and build the UI using a ROW
CodePudding user response:
Appbar has a shape that can be edited
AppBar(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(25.0),
topRight: Radius.circular(25.0)
)
)
CodePudding user response:
try this
class CustomBarWidget extends StatelessWidget {
GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey();
@override
Widget build(BuildContext context) {
return Scaffold(
key: _scaffoldKey,
body: Container(
height: 160.0,
child: Stack(
children: <Widget>[
Positioned(
top: 10.0,
left: 0.0,
right: 0.0,
child: Container(
padding: EdgeInsets.symmetric(horizontal: 20.0),
child: DecoratedBox(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(1.0),
border: Border.all(
color: Colors.grey.withOpacity(0.5), width: 1.0),
color: Colors.white),
child: Row(
children: [
IconButton(
icon: Icon(
Icons.menu,
color: Colors.red,
),
onPressed: () {
print("your menu action here");
_scaffoldKey.currentState.openDrawer();
},
),
Expanded(
child: TextField(
decoration: InputDecoration(
hintText: "Search",
),
),
),
IconButton(
icon: Icon(
Icons.search,
color: Colors.red,
),
onPressed: () {
print("your menu action here");
},
),
IconButton(
icon: Icon(
Icons.notifications,
color: Colors.red,
),
onPressed: () {
print("your menu action here");
},
),
],
),
),
),
)
],
),
),
);
}
}
CodePudding user response:
Here you go
floatingActionButtonLocation: FloatingActionButtonLocation.centerTop,
floatingActionButton: Column(children: [
Container(
decoration: BoxDecoration(
color: Colors.red, borderRadius: BorderRadius.circular(5)),
margin: EdgeInsets.symmetric(horizontal: 20, vertical: 10),
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 5, vertical: 5),
child: Row(
children: [Text("a")],
),
),
),
]),