navbar and setting bar is done
This commit is contained in:
126
lib/widgets/settings_bar.dart
Normal file
126
lib/widgets/settings_bar.dart
Normal file
@@ -0,0 +1,126 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
|
||||
class SettingsBar extends StatelessWidget {
|
||||
final int selectedIndex;
|
||||
final ValueChanged<int> onTap;
|
||||
final bool showBackButton;
|
||||
final VoidCallback? onBackTap;
|
||||
final List<String> iconPaths;
|
||||
|
||||
const SettingsBar({
|
||||
super.key,
|
||||
required this.selectedIndex,
|
||||
required this.onTap,
|
||||
this.showBackButton = false,
|
||||
this.onBackTap,
|
||||
required this.iconPaths,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
color: Colors.transparent,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 10.0),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Image.asset(
|
||||
'assets/images/logo2.png',
|
||||
width: 150,
|
||||
height: 40,
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
// Navigation icons on the right
|
||||
Row(
|
||||
children: [
|
||||
// Back button (only shown when showBackButton is true)
|
||||
if (showBackButton)
|
||||
GestureDetector(
|
||||
onTap: onBackTap,
|
||||
child: Container(
|
||||
width: 50,
|
||||
height: 50,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
shape: BoxShape.circle,
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: const Color(0x10000000),
|
||||
blurRadius: 5,
|
||||
offset: const Offset(0, 2),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: const Center(
|
||||
child: Icon(
|
||||
Icons.arrow_back,
|
||||
color: Color(0xFF006838),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
// Add spacing if back button is shown
|
||||
if (showBackButton) const SizedBox(width: 20),
|
||||
|
||||
// Settings and notification icons
|
||||
...iconPaths.asMap().entries.map((entry) {
|
||||
final index = entry.key;
|
||||
final iconPath = entry.value;
|
||||
final isSelected = selectedIndex == index;
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(left: 10),
|
||||
child: GestureDetector(
|
||||
onTap: () => onTap(index),
|
||||
child: Container(
|
||||
width: 43,
|
||||
height: 43,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
shape: BoxShape.circle,
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: const Color(0x10000000),
|
||||
blurRadius: 5,
|
||||
offset: const Offset(0, 2),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Center(
|
||||
child: Stack(
|
||||
children: [
|
||||
SvgPicture.asset(
|
||||
iconPath,
|
||||
width: 30,
|
||||
height: 30,
|
||||
|
||||
),
|
||||
if (index == 1)
|
||||
Positioned(
|
||||
top: 0,
|
||||
right: 0,
|
||||
child: Container(
|
||||
width: 10,
|
||||
height: 10,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user