Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix fix fix fix #58

Merged
merged 2 commits into from
Nov 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 29 additions & 6 deletions lib/components/bottom_menu.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import 'package:badges/badges.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:livrodin/components/profile_icon.dart';
import 'package:livrodin/configs/themes.dart';
import 'package:livrodin/controllers/auth_controller.dart';
import 'package:livrodin/controllers/notification_controller.dart';

class BottomMenu extends StatefulWidget {
BottomMenu({
Expand All @@ -20,6 +22,9 @@ class BottomMenu extends StatefulWidget {

class _BottomMenuState extends State<BottomMenu> {
final AuthController authController = Get.find<AuthController>();

final NotificationController _notificationController =
Get.find<NotificationController>();
@override
Widget build(BuildContext context) {
return Stack(
Expand Down Expand Up @@ -124,12 +129,30 @@ class _BottomMenuState extends State<BottomMenu> {
child: SizedBox(
width: 50,
height: 50,
child: Icon(
Icons.notifications_rounded,
size: 28,
color: widget._selectefIndex.value == 2
? Colors.black
: grey,
child: Obx(
() {
var count = _notificationController
.notifications.length;
return Badge(
showBadge: count > 0,
badgeColor: red,
badgeContent: Text(
count < 10 ? "0$count" : "$count",
style: const TextStyle(
color: Colors.white,
fontSize: 10,
fontWeight: FontWeight.w800,
),
),
child: Icon(
Icons.notifications_rounded,
size: 28,
color: widget._selectefIndex.value == 2
? Colors.black
: grey,
),
);
},
),
),
),
Expand Down
1 change: 1 addition & 0 deletions lib/controllers/messages_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class MessagesController extends GetxController {
}

void sendMessage() {
if (textInputController.text.trim().isEmpty) return;
_bookController.sendTransactionMessage(
transaction.id, textInputController.text);
textInputController.clear();
Expand Down