You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
	
	
		
			64 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			Dart
		
	
			
		
		
	
	
			64 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			Dart
		
	
| import 'package:flutter/material.dart';
 | |
| 
 | |
| class GradientAppBar extends StatelessWidget {
 | |
|   final String title;
 | |
|   final double barHeight = 50.0;
 | |
|   IconData? iconData;
 | |
| 
 | |
|   GradientAppBar(this.title, {this.iconData});
 | |
| 
 | |
|   @override
 | |
|   Widget build(BuildContext context) {
 | |
|     final double statusbarHeight = MediaQuery.of(context).padding.top;
 | |
| 
 | |
|     return new Container(
 | |
|       padding: EdgeInsets.only(top: statusbarHeight),
 | |
|       height: statusbarHeight + barHeight,
 | |
|       child: Row(
 | |
|         children: [
 | |
|           IconButton(
 | |
|             onPressed: () {
 | |
|               Navigator.pop(context);
 | |
|             },
 | |
|             icon: Icon(
 | |
|               Icons.arrow_back_ios,
 | |
|               color: Colors.white,
 | |
|             ),
 | |
|           ),
 | |
|           Expanded(
 | |
|             child: Center(
 | |
|               child: Text(
 | |
|                 title,
 | |
|                 style: TextStyle(
 | |
|                     fontSize: 20.0,
 | |
|                     color: Colors.white,
 | |
|                     fontWeight: FontWeight.bold),
 | |
|               ),
 | |
|             ),
 | |
|           ),
 | |
|           if (iconData != null)
 | |
|             IconButton(
 | |
|               onPressed: () {},
 | |
|               icon: Icon(
 | |
|                 iconData,
 | |
|                 color: Colors.white,
 | |
|               ),
 | |
|             ),
 | |
|         ],
 | |
|       ),
 | |
|       decoration: BoxDecoration(
 | |
|         gradient: LinearGradient(
 | |
|           colors: [
 | |
|             Colors.black.withOpacity(0.4),
 | |
|             Colors.black.withOpacity(0.2),
 | |
|             Colors.black.withOpacity(0.0001),
 | |
|           ],
 | |
|           begin: Alignment.topCenter,
 | |
|           end: Alignment.bottomCenter,
 | |
|           tileMode: TileMode.clamp,
 | |
|         ),
 | |
|       ),
 | |
|     );
 | |
|   }
 | |
| }
 |