Skip to content

Commit

Permalink
new chat button on app bar
Browse files Browse the repository at this point in the history
  • Loading branch information
Dat-TG committed Dec 29, 2023
1 parent 32fd882 commit afba54b
Showing 1 changed file with 23 additions and 7 deletions.
30 changes: 23 additions & 7 deletions lib/core/widgets/main_app_bar.dart
Original file line number Diff line number Diff line change
@@ -1,20 +1,36 @@
import 'package:boilerplate/di/service_locator.dart';
import 'package:boilerplate/presentation/chat_screen/store/chat_store.dart';
import 'package:flutter/material.dart';
import 'package:flutter_mobx/flutter_mobx.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';

class MainAppBar extends StatelessWidget {
class MainAppBar extends StatefulWidget {
const MainAppBar({super.key});

@override
State<MainAppBar> createState() => _MainAppBarState();
}

class _MainAppBarState extends State<MainAppBar> {
ChatStore _chatStore = getIt<ChatStore>();
@override
Widget build(BuildContext context) {
return AppBar(
title: Text('ChatGPT'),
actions: [
IconButton(
icon: FaIcon(FontAwesomeIcons.penToSquare),
splashRadius: 20,
iconSize: 20,
onPressed: () {},
),
Observer(builder: (context) {
return IconButton(
icon: FaIcon(FontAwesomeIcons.penToSquare),
splashRadius: 20,
iconSize: 20,
disabledColor: Colors.grey,
onPressed: _chatStore.id > 0
? () {
_chatStore.setChatThreadId(-1);
}
: null,
);
}),
IconButton(
icon: FaIcon(FontAwesomeIcons.ellipsisVertical),
splashRadius: 20,
Expand Down

0 comments on commit afba54b

Please sign in to comment.