Fakultas Ilmu Komputer UI

Commit 3f4ddbbd authored by Yoga Pratama's avatar Yoga Pratama
Browse files

[CHORES] Change dropdown banner to flushbar

parent bcb60827
import 'package:dropdown_banner/dropdown_banner.dart';
import 'package:flutter/material.dart';
import 'package:bisaGo/config/styles.dart';
import 'package:bisaGo/page/dashboard/dashboard.dart';
......@@ -8,8 +7,6 @@ class BisaGo extends StatelessWidget {
@override
Widget build(BuildContext context) {
final navigatorKey = GlobalKey<NavigatorState>();
return MaterialApp(
title: 'bisaGo',
theme: ThemeData(
......@@ -17,10 +14,7 @@ class BisaGo extends StatelessWidget {
primaryColor: greenPrimary,
backgroundColor: Colors.white,
),
home: DropdownBanner(
navigatorKey: navigatorKey,
child: Dashboard(),
),
home: Dashboard(),
);
}
}
......@@ -12,10 +12,10 @@ import 'package:bisaGo/page/filter_fasilitas/postingan/detail_post.dart';
import 'package:bisaGo/repository/komentar_repository.dart';
import 'package:bisaGo/utils/custom_dashboard_location_button.dart';
import 'package:bisaGo/utils/location_turn_on_dialog.dart';
import 'package:dropdown_banner/dropdown_banner.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_dynamic_links/firebase_dynamic_links.dart';
import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:flushbar/flushbar.dart';
import 'package:flutter/material.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart';
import 'package:geolocator/geolocator.dart';
......@@ -79,25 +79,26 @@ class DashboardState extends State<Dashboard> {
_lastNotification = now;
final data = message.data;
final String msg = data['message'];
DropdownBanner.showBanner(
text: msg,
color: Color(0xFF003566),
textStyle: TextStyle(
color: Colors.white,
height: 2.1,
),
duration: Duration(seconds: 8),
tapCallback: () {
if (data['type'] == 'fasilitas') {
final String placeId = data['place_id'];
final id = int.parse(data['id']);
_navigateToDetailFasilitasPage(context, placeId, id);
} else if (data['type'] == 'kegiatan') {
final String placeId = data['place_id'];
final id = int.parse(data['id']);
_navigateToDetailKegiatanPage(context, placeId, id);
}
});
final String title = data['title'];
Flushbar(
title: title,
message: '"$msg"',
duration: Duration(seconds: 8),
backgroundColor: Color(0xFF003566),
onTap: (_) {
if (data['type'] == 'fasilitas') {
final String placeId = data['place_id'];
final id = int.parse(data['id']);
_navigateToDetailFasilitasPage(context, placeId, id);
} else if (data['type'] == 'kegiatan') {
final String placeId = data['place_id'];
final id = int.parse(data['id']);
_navigateToDetailKegiatanPage(context, placeId, id);
}
},
flushbarStyle: FlushbarStyle.GROUNDED,
flushbarPosition: FlushbarPosition.TOP,
).show(context);
});
FirebaseMessaging.onMessageOpenedApp.listen((message) {
......
......@@ -57,7 +57,7 @@ dependencies:
firebase_dynamic_links: ^0.7.0+1
firebase_messaging: ^8.0.0-dev.15
carousel_slider: ^3.0.0
dropdown_banner: ^1.4.0
flushbar: ^1.10.4
dev_dependencies:
flutter_test:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment