fix(ui): Fix some ui bugs
This commit is contained in:
@@ -177,6 +177,8 @@ class _LoginScreenState extends State<LoginScreen> {
|
||||
_formKey.currentState!.save();
|
||||
var data =
|
||||
await apiServices.login(APIPathConstants.LOGIN_PATH, loginRequest);
|
||||
log("Data: $data");
|
||||
// log(message)
|
||||
if (data != "") {
|
||||
Map<String, dynamic> tokenData = jsonDecode(data);
|
||||
String token = tokenData['token'];
|
||||
|
||||
@@ -48,7 +48,7 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
super.initState();
|
||||
homeBloc = BlocProvider.of(context);
|
||||
getOwnerAndJoinedDevices();
|
||||
const duration = Duration(seconds: 20);
|
||||
const duration = Duration(seconds: 10);
|
||||
getAllDevicesTimer =
|
||||
Timer.periodic(duration, (Timer t) => getOwnerAndJoinedDevices());
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import 'package:go_router/go_router.dart';
|
||||
// import 'package:persistent_bottom_nav_bar_v2/persistent-tab-view.dart';
|
||||
import 'package:badges/badges.dart' as badges;
|
||||
import 'package:persistent_bottom_nav_bar/persistent_bottom_nav_bar.dart';
|
||||
import 'package:sfm_app/feature/sound_notification_test/notification_screen.dart';
|
||||
import '../settings/profile/profile_model.dart';
|
||||
import '../../product/extention/context_extention.dart';
|
||||
import '../../bloc/home_bloc.dart';
|
||||
@@ -33,6 +34,7 @@ import '../../product/constant/icon/icon_constants.dart';
|
||||
import '../../product/constant/lang/language_constants.dart';
|
||||
import '../../product/services/language_services.dart';
|
||||
import '../bell/bell_model.dart';
|
||||
import '../sound_notification_test/notification_bloc.dart';
|
||||
|
||||
class MainScreen extends StatefulWidget {
|
||||
const MainScreen({super.key});
|
||||
@@ -146,6 +148,15 @@ class _MainScreenState extends State<MainScreen> with WidgetsBindingObserver {
|
||||
inactiveIcon:
|
||||
IconConstants.instance.getMaterialIcon(Icons.group_outlined),
|
||||
),
|
||||
PersistentBottomNavBarItem(
|
||||
icon: IconConstants.instance
|
||||
.getMaterialIcon(Icons.notifications_outlined),
|
||||
title: appLocalization(context).notification,
|
||||
activeColorPrimary: Colors.blue,
|
||||
inactiveColorPrimary: Colors.grey,
|
||||
inactiveIcon: IconConstants.instance
|
||||
.getMaterialIcon(Icons.notifications_outlined),
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -170,6 +181,10 @@ class _MainScreenState extends State<MainScreen> with WidgetsBindingObserver {
|
||||
child: const InterFamilyScreen(),
|
||||
blocBuilder: () => InterFamilyBloc(),
|
||||
),
|
||||
BlocProvider(
|
||||
child: const NotificationScreen(),
|
||||
blocBuilder: () => NotificationBloc(),
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -54,6 +54,8 @@ class _MapScreenState extends State<MapScreen> with WidgetsBindingObserver {
|
||||
// LatLng myLocation = const LatLng(213761, 123123);
|
||||
// Position? position;
|
||||
// bool isAllowLocationPermission = false;
|
||||
Timer? checkThemeTimer;
|
||||
Timer? getMarker;
|
||||
String themeMode = '';
|
||||
@override
|
||||
void initState() {
|
||||
@@ -62,11 +64,17 @@ class _MapScreenState extends State<MapScreen> with WidgetsBindingObserver {
|
||||
_loadIcons();
|
||||
getAllMarkers();
|
||||
clusterManager = _initClusterManager();
|
||||
const duration = Duration(seconds: 2);
|
||||
checkThemeTimer = Timer.periodic(duration, (Timer t) => checkTheme());
|
||||
const Duration markerDuration = Duration(seconds: 5);
|
||||
getMarker = Timer.periodic(markerDuration, (Timer t) => getAllMarkers());
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
super.dispose();
|
||||
checkThemeTimer?.cancel();
|
||||
getMarker?.cancel();
|
||||
_controller = Completer();
|
||||
streamController.close();
|
||||
}
|
||||
@@ -142,7 +150,6 @@ class _MapScreenState extends State<MapScreen> with WidgetsBindingObserver {
|
||||
return rootBundle.loadString(path);
|
||||
}
|
||||
|
||||
|
||||
Future<void> _loadIcons() async {
|
||||
List<Future<BitmapDescriptor>> iconFutures = imageAssets.map((asset) {
|
||||
return BitmapDescriptor.asset(
|
||||
@@ -245,7 +252,7 @@ class _MapScreenState extends State<MapScreen> with WidgetsBindingObserver {
|
||||
hasOtherState = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (hasStateOne) {
|
||||
return true; // flameIcon
|
||||
} else if (hasOtherState) {
|
||||
|
||||
11
lib/feature/sound_notification_test/notification_bloc.dart
Normal file
11
lib/feature/sound_notification_test/notification_bloc.dart
Normal file
@@ -0,0 +1,11 @@
|
||||
import 'package:sfm_app/product/base/bloc/base_bloc.dart';
|
||||
|
||||
class NotificationBloc extends BlocBase{
|
||||
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
// TODO: implement dispose
|
||||
}
|
||||
|
||||
}
|
||||
40
lib/feature/sound_notification_test/notification_screen.dart
Normal file
40
lib/feature/sound_notification_test/notification_screen.dart
Normal file
@@ -0,0 +1,40 @@
|
||||
import 'dart:developer';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'notification_bloc.dart';
|
||||
import '../../product/base/bloc/base_bloc.dart';
|
||||
import '../../product/services/notification_services.dart';
|
||||
|
||||
class NotificationScreen extends StatefulWidget {
|
||||
const NotificationScreen({super.key});
|
||||
|
||||
@override
|
||||
State<NotificationScreen> createState() => _NotificationScreenState();
|
||||
}
|
||||
|
||||
class _NotificationScreenState extends State<NotificationScreen> {
|
||||
late NotificationBloc notificationBloc;
|
||||
NotificationServices notificationServices = NotificationServices();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
notificationBloc = BlocProvider.of<NotificationBloc>(context);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
log("Token: ${notificationServices.getDeviceToken()}");
|
||||
},
|
||||
child: Text("Get Notification Token"))
|
||||
],
|
||||
));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user