105 lines
3.5 KiB
Dart
105 lines
3.5 KiB
Dart
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, // to switch between back button and settings icons
|
|
this.onBackTap,
|
|
required this.iconPaths,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Container(
|
|
color: Colors.transparent,
|
|
padding: const EdgeInsets.symmetric(horizontal: 20.0, vertical: 20.0),
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
Row(
|
|
children: [
|
|
Image.asset('assets/images/logo2.png', width: 150, height: 40),
|
|
],
|
|
),
|
|
Row(
|
|
children: [
|
|
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: Center(
|
|
// Always use Flutter's built-in back icon pointing to the right
|
|
child: const Icon(
|
|
Icons.arrow_forward, // Changed to arrow_forward for RTL
|
|
size: 26,
|
|
color: Colors.black, // Adjust color as needed
|
|
),
|
|
),
|
|
),
|
|
),
|
|
|
|
// When back button is OFF → show user + settings icons
|
|
if (!showBackButton)
|
|
...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),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
} |