apptomate_custom_appbar 0.0.1
apptomate_custom_appbar: ^0.0.1 copied to clipboard
An enhanced AppBar implementation with additional customization options beyond Flutter's standard AppBar.
example/lib/main.dart
import 'package:apptomate_custom_appbar/apptomate_custom_appbar.dart';
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
theme: ThemeData(primarySwatch: Colors.blue),
home: const CustomAppBarWidget(),
);
}
}
class CustomAppBarWidget extends StatelessWidget {
const CustomAppBarWidget({super.key});
@override
Widget build(BuildContext context) {
return DefaultTabController(
length: 2, // Ensures TabBar works properly
child: Scaffold(
appBar: CustomAppBar(
title: 'Enhanced AppBar',
titleWidget: Text("Enhanced AppBar",style: TextStyle(color: Colors.white),),
gradient: const LinearGradient(
colors: [Colors.purple, Colors.blue],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
),
elevation: 2.0,
leadingIcon: Icons.arrow_back,
onLeadingPressed: () {
Navigator.pop(context);
},
actions: [
IconButton(
icon: const Icon(Icons.search, color: Colors.white),
onPressed: () {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('Search pressed')),
);
},
),
IconButton(
icon: const Icon(Icons.more_vert, color: Colors.white),
onPressed: () {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('More pressed')),
);
},
),
],
bottom: const TabBar(
tabs: [
Tab(icon: Icon(Icons.home)),
Tab(icon: Icon(Icons.settings)),
],
),
),
body: const TabBarView(
children: [
Center(child: Text('Home Tab')),
Center(child: Text('Settings Tab')),
],
),
),
);
}
}