didvan-app/lib/views/widgets/hoshan_app_bar.dart

102 lines
3.4 KiB
Dart

import 'dart:math';
import 'package:didvan/config/theme_data.dart';
import 'package:didvan/constants/app_icons.dart';
import 'package:didvan/routes/routes.dart';
import 'package:didvan/views/ai/ai_state.dart';
import 'package:didvan/views/widgets/didvan/icon_button.dart';
import 'package:didvan/views/widgets/didvan/text.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
class HoshanAppBar extends StatelessWidget implements PreferredSizeWidget {
final Function()? onBack;
final bool withInfo;
final bool withActions;
const HoshanAppBar(
{Key? key, this.onBack, this.withActions = true, this.withInfo = true})
: super(key: key);
@override
Widget build(BuildContext context) {
return Container(
decoration: BoxDecoration(
borderRadius: const BorderRadius.only(
bottomLeft: Radius.circular(20),
bottomRight: Radius.circular(20)),
color: Theme.of(context).colorScheme.surface,
boxShadow: [
BoxShadow(
color: const Color(0XFF1B3C59).withValues(alpha: 0.15),
blurRadius: 8,
spreadRadius: 0,
offset: const Offset(0, 8),
)
],
),
padding: const EdgeInsets.all(16),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
Icon(
DidvanIcons.ai_solid,
size: 40,
color: Theme.of(context).colorScheme.title,
),
DidvanText(
'هوشان',
fontSize: 14,
color: Theme.of(context).colorScheme.title,
fontWeight: FontWeight.bold,
),
],
),
Row(
children: [
if (withInfo)
DidvanIconButton(
icon: DidvanIcons.info_circle_light,
size: 32,
onPressed: () {
Navigator.pushNamed(context, Routes.info);
}),
if (withActions)
// Stack(
// children: [
// DidvanIconButton(
// icon: DidvanIcons.ai_regular,
// size: 32,
// onPressed: () {
// context.read<BotAssistantsState>().getMyAssissmant();
// Navigator.pushNamed(context, Routes.botAssistants);
// },
// ),
// Icon(
// CupertinoIcons.plus,
// color: Theme.of(context).colorScheme.primary,
// size: 16,
// )
// ],
// ),
if (context.watch<AiState>().page != 0 || !withActions)
Transform.rotate(
angle: 180 * pi / 180,
child: DidvanIconButton(
icon: DidvanIcons.back_light,
size: 32,
onPressed: () => onBack?.call(),
),
),
],
)
],
));
}
@override
Size get preferredSize => const Size(double.infinity, 144);
}