100 lines
3.3 KiB
Dart
100 lines
3.3 KiB
Dart
import 'dart:math';
|
|
|
|
import 'package:didvan/constants/app_icons.dart';
|
|
import 'package:didvan/constants/assets.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 withActions;
|
|
const HoshanAppBar({Key? key, this.onBack, this.withActions = 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).withOpacity(0.15),
|
|
blurRadius: 8,
|
|
spreadRadius: 0,
|
|
offset: const Offset(0, 8),
|
|
)
|
|
],
|
|
),
|
|
padding: const EdgeInsets.all(16),
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
const Row(
|
|
children: [
|
|
Icon(
|
|
DidvanIcons.ai_solid,
|
|
size: 40,
|
|
),
|
|
DidvanText(
|
|
'هوشان',
|
|
fontSize: 14,
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
],
|
|
),
|
|
Row(
|
|
children: [
|
|
if (withActions)
|
|
DidvanIconButton(
|
|
icon: DidvanIcons.info_circle_light,
|
|
size: 32,
|
|
onPressed: () {
|
|
Navigator.pushNamed(context, Routes.info);
|
|
}),
|
|
if (withActions)
|
|
DidvanIconButton(
|
|
icon: DidvanIcons.antenna_light,
|
|
size: 32,
|
|
onPressed: () {
|
|
Navigator.pushNamed(context, Routes.botAssistants);
|
|
},
|
|
),
|
|
context.watch<AiState>().page != 0 || !withActions
|
|
? Transform.rotate(
|
|
angle: 180 * pi / 180,
|
|
child: DidvanIconButton(
|
|
icon: DidvanIcons.back_light,
|
|
size: 32,
|
|
onPressed: () => onBack?.call(),
|
|
),
|
|
)
|
|
: InkWell(
|
|
onTap: () {
|
|
context.read<AiState>().goToTools();
|
|
},
|
|
child: Padding(
|
|
padding: const EdgeInsets.only(right: 8.0),
|
|
child: Image.asset(
|
|
Assets.boxAnimation,
|
|
width: 38,
|
|
height: 38,
|
|
),
|
|
),
|
|
),
|
|
],
|
|
)
|
|
],
|
|
));
|
|
}
|
|
|
|
@override
|
|
Size get preferredSize => const Size(double.infinity, 144);
|
|
}
|