ai option in action bar added.

main_production_copilot
Sikander Saleem 6 hours ago
parent 85af9ee03e
commit 22f3727677

@ -132,6 +132,7 @@ class _CopilotChatPageState extends State<CopilotChatPage> {
return Scaffold(
appBar: DefaultAppBar(
title: "ATOMS – AI Assistant",
showCopilot: false,
actions: [
IconButton(
onPressed: () => Navigator.push(context, MaterialPageRoute(builder: (_) => const CopilotLiveTalkPage())),

@ -122,7 +122,10 @@ class _CopilotPushToTalkPageState extends State<CopilotPushToTalkPage> with Widg
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: const DefaultAppBar(title: "Push to Talk"),
appBar: const DefaultAppBar(
title: "Push to Talk",
showCopilot: false,
),
body: Column(
children: [
Expanded(

@ -92,6 +92,7 @@ class _DeviceFilterScreenState extends State<DeviceFilterScreen> {
appBar: DefaultAppBar(
title: context.translation.filter,
showBackButtonAsCancel: true,
showCopilot: false,
actions: [
if (loading == false && _showResetButton())
TextButton(

@ -62,6 +62,7 @@ class _DeviceSearchScreenState extends State<DeviceSearchScreen> {
appBar: DefaultAppBar(
title: context.translation.search,
showBackButtonAsCancel: true,
showCopilot: false,
actions: [
if (_showResetButton())
TextButton(

@ -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)

@ -179,6 +179,7 @@ class _AllRequestsFilterPageState extends State<AllRequestsFilterPage> {
return Scaffold(
appBar: DefaultAppBar(
title: context.translation.filter,showBackButtonAsCancel: true,
showCopilot: false,
actions: [
if (_showResetButton())
TextButton(

@ -93,6 +93,7 @@ class _AllRequestsSearchPageState extends State<AllRequestsSearchPage> {
appBar: DefaultAppBar(
title: context.translation.search,
showBackButtonAsCancel: true,
showCopilot: false,
actions: [
if (_showResetButton())
TextButton(

Loading…
Cancel
Save