Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class CustomAppBarr extends StatelessWidget implements PreferredSizeWidget {
- @override
- Size get preferredSize => Size.fromHeight(160.0);
- @override
- Widget build(BuildContext context) {
- return AppBar(
- flexibleSpace: Container(
- decoration: BoxDecoration(
- gradient: LinearGradient(
- colors: [Color(0xFFEC407A), Color(0xFF8E24AA)],
- begin: Alignment.topLeft,
- end: Alignment.bottomRight,
- ),
- ),
- ),
- title: Padding(
- padding: const EdgeInsets.only(top: 18.0),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(
- 'Events near me',
- style: TextStyle(
- fontSize: 16,
- color: Colors.white70,
- ),
- ),
- Text(
- 'California, USA',
- style: TextStyle(
- fontSize: 24,
- fontWeight: FontWeight.bold,
- ),
- ),
- ],
- ),
- ),
- actions: [
- IconButton(
- icon: Icon(Icons.notifications, size: 30),
- onPressed: () {
- // Add notification functionality here
- },
- ),
- ],
- bottom: PreferredSize(
- preferredSize: Size.fromHeight(76.0), // Adjust this height if needed
- child: Padding(
- padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0),
- child: Column(
- children: [
- TextField(
- decoration: InputDecoration(
- hintText: 'Search events',
- prefixIcon: Icon(Icons.search, color: Colors.grey),
- suffixIcon: Icon(Icons.filter_alt, color: Colors.grey),
- filled: true,
- fillColor: Colors.white,
- border: OutlineInputBorder(
- borderRadius: BorderRadius.circular(30.0),
- borderSide: BorderSide.none,
- ),
- ),
- ),
- SizedBox(height: 20,)
- ],
- ),
- ),
- ),
- );
- }
- }
- Second code:
- class CustomAppBar extends StatelessWidget {
- @override
- Widget build(BuildContext context) {
- return Container(
- decoration: BoxDecoration(
- color: Colors.blue,
- borderRadius: BorderRadius.only(
- bottomLeft: Radius.circular(35.0),
- bottomRight: Radius.circular(35.0),
- ),
- ),
- padding: EdgeInsets.only(top: MediaQuery.of(context).padding.top),
- child: AppBar(
- backgroundColor: Colors.transparent,
- elevation: 0,
- title: Center(
- child: Text(
- 'Custom App Bar',
- style: TextStyle(
- fontSize: 20.0,
- fontWeight: FontWeight.bold,
- ),
- ),
- ),
- automaticallyImplyLeading: false,
- ),
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement