reusable_app_bar 0.0.1
reusable_app_bar: ^0.0.1 copied to clipboard
A customizable Flutter package providing advanced AppBar widgets with flexible layouts, profile avatars, background images, and more.
import 'package:flutter/material.dart';
import 'package:reusable_app_bar/views/app_bars/reusable_app_bar.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Reusable App Bar Demo',
theme: ThemeData(
primarySwatch: Colors.teal,
),
home: const HomeScreen(),
);
}
}
class HomeScreen extends StatelessWidget {
const HomeScreen({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppSimpleAppBar(
titleTxt: 'Home',
centerTitle: true,
bgColor: Colors.teal,
actions: [
IconButton(
icon: const Icon(Icons.search),
onPressed: () {
// Handle search
},
),
],
),
body: Center(
child: ElevatedButton(
child: const Text('Go to Profile'),
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => const ProfileScreen()),
);
},
),
),
);
}
}
class ProfileScreen extends StatelessWidget {
const ProfileScreen({super.key});
@override
Widget build(BuildContext context) {
return BottomMiddleAvatarScaffold(
titleTxt: 'Profile',
bgImageSource: 'https://via.placeholder.com/600x200',
imageSource: 'https://via.placeholder.com/150',
body: const Center(
child: Text('User Profile Page'),
),
);
}
}