|
|
|
|
@ -1,10 +1,13 @@
|
|
|
|
|
import 'dart:io';
|
|
|
|
|
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
import 'package:test_sa/extensions/context_extension.dart';
|
|
|
|
|
import 'package:test_sa/extensions/int_extensions.dart';
|
|
|
|
|
import 'package:test_sa/extensions/text_extensions.dart';
|
|
|
|
|
import 'package:test_sa/extensions/widget_extensions.dart';
|
|
|
|
|
import 'package:test_sa/modules/copilot/controller/copilot_provider.dart';
|
|
|
|
|
import 'package:test_sa/modules/copilot/screens/copilot_chat_page.dart';
|
|
|
|
|
import 'package:test_sa/new_views/pages/land_page/land_page.dart';
|
|
|
|
|
import 'package:test_sa/new_views/swipe_module/dialoge/acknowledge_work_dialog.dart';
|
|
|
|
|
|
|
|
|
|
@ -20,9 +23,20 @@ class DefaultAppBar extends StatelessWidget implements PreferredSizeWidget {
|
|
|
|
|
final VoidCallback? onWillPopScope;
|
|
|
|
|
final TextStyle? titleStyle;
|
|
|
|
|
final bool showBackButtonAsCancel;
|
|
|
|
|
final bool showCopilot;
|
|
|
|
|
|
|
|
|
|
const DefaultAppBar(
|
|
|
|
|
{this.title, this.onBackPress, this.onWillPopScope, this.actions, this.titleStyle, this.showHomeActionButton = false, this.showBackButton = true,this.backgroundColor, this.showBackButtonAsCancel = false, Key? key})
|
|
|
|
|
{this.title,
|
|
|
|
|
this.onBackPress,
|
|
|
|
|
this.onWillPopScope,
|
|
|
|
|
this.actions,
|
|
|
|
|
this.titleStyle,
|
|
|
|
|
this.showHomeActionButton = false,
|
|
|
|
|
this.showCopilot = true,
|
|
|
|
|
this.showBackButton = true,
|
|
|
|
|
this.backgroundColor,
|
|
|
|
|
this.showBackButtonAsCancel = false,
|
|
|
|
|
Key? key})
|
|
|
|
|
: super(key: key);
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
@ -44,10 +58,24 @@ class DefaultAppBar extends StatelessWidget implements PreferredSizeWidget {
|
|
|
|
|
if (actions?.isNotEmpty ?? false) {
|
|
|
|
|
_actions.addAll(actions!);
|
|
|
|
|
}
|
|
|
|
|
if (showCopilot) {
|
|
|
|
|
_actions.add(
|
|
|
|
|
IconButton(
|
|
|
|
|
icon: "atoms_ai".toSvgAsset(),
|
|
|
|
|
padding: EdgeInsets.zero,
|
|
|
|
|
iconSize: 20,
|
|
|
|
|
visualDensity: VisualDensity.compact,
|
|
|
|
|
tooltip: "Barq",
|
|
|
|
|
onPressed: (() {
|
|
|
|
|
context.read<CopilotProvider>().startNewConversation();
|
|
|
|
|
Navigator.push(context, MaterialPageRoute(builder: (_) => const CopilotChatPage(isNewConversation: true))).then((_) => context.read<CopilotProvider>().loadHistory());
|
|
|
|
|
})),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
return AppBar(
|
|
|
|
|
automaticallyImplyLeading: false,
|
|
|
|
|
titleSpacing: 16,
|
|
|
|
|
backgroundColor:backgroundColor,
|
|
|
|
|
backgroundColor: backgroundColor,
|
|
|
|
|
title: Row(
|
|
|
|
|
children: [
|
|
|
|
|
if (showBackButton)
|
|
|
|
|
|