fix(ui): Fix some ui bugs
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<uses-permission android:name="android.permission.INTERNET"/>
|
<uses-permission android:name="android.permission.INTERNET"/>
|
||||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
|
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
|
||||||
<uses-permission android:name="android.permission.VIBRATE" />
|
<uses-permission android:name="android.permission.VIBRATE" />
|
||||||
<uses-permission android:name="android.permission.USE_FULL_SCREEN_INTENT" />
|
<uses-permission android:name="android.permission.USE_FULL_SCREEN_INTENT" />
|
||||||
|
|||||||
@@ -177,6 +177,8 @@ class _LoginScreenState extends State<LoginScreen> {
|
|||||||
_formKey.currentState!.save();
|
_formKey.currentState!.save();
|
||||||
var data =
|
var data =
|
||||||
await apiServices.login(APIPathConstants.LOGIN_PATH, loginRequest);
|
await apiServices.login(APIPathConstants.LOGIN_PATH, loginRequest);
|
||||||
|
log("Data: $data");
|
||||||
|
// log(message)
|
||||||
if (data != "") {
|
if (data != "") {
|
||||||
Map<String, dynamic> tokenData = jsonDecode(data);
|
Map<String, dynamic> tokenData = jsonDecode(data);
|
||||||
String token = tokenData['token'];
|
String token = tokenData['token'];
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ class _HomeScreenState extends State<HomeScreen> {
|
|||||||
super.initState();
|
super.initState();
|
||||||
homeBloc = BlocProvider.of(context);
|
homeBloc = BlocProvider.of(context);
|
||||||
getOwnerAndJoinedDevices();
|
getOwnerAndJoinedDevices();
|
||||||
const duration = Duration(seconds: 20);
|
const duration = Duration(seconds: 10);
|
||||||
getAllDevicesTimer =
|
getAllDevicesTimer =
|
||||||
Timer.periodic(duration, (Timer t) => getOwnerAndJoinedDevices());
|
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:persistent_bottom_nav_bar_v2/persistent-tab-view.dart';
|
||||||
import 'package:badges/badges.dart' as badges;
|
import 'package:badges/badges.dart' as badges;
|
||||||
import 'package:persistent_bottom_nav_bar/persistent_bottom_nav_bar.dart';
|
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 '../settings/profile/profile_model.dart';
|
||||||
import '../../product/extention/context_extention.dart';
|
import '../../product/extention/context_extention.dart';
|
||||||
import '../../bloc/home_bloc.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/constant/lang/language_constants.dart';
|
||||||
import '../../product/services/language_services.dart';
|
import '../../product/services/language_services.dart';
|
||||||
import '../bell/bell_model.dart';
|
import '../bell/bell_model.dart';
|
||||||
|
import '../sound_notification_test/notification_bloc.dart';
|
||||||
|
|
||||||
class MainScreen extends StatefulWidget {
|
class MainScreen extends StatefulWidget {
|
||||||
const MainScreen({super.key});
|
const MainScreen({super.key});
|
||||||
@@ -146,6 +148,15 @@ class _MainScreenState extends State<MainScreen> with WidgetsBindingObserver {
|
|||||||
inactiveIcon:
|
inactiveIcon:
|
||||||
IconConstants.instance.getMaterialIcon(Icons.group_outlined),
|
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(),
|
child: const InterFamilyScreen(),
|
||||||
blocBuilder: () => InterFamilyBloc(),
|
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);
|
// LatLng myLocation = const LatLng(213761, 123123);
|
||||||
// Position? position;
|
// Position? position;
|
||||||
// bool isAllowLocationPermission = false;
|
// bool isAllowLocationPermission = false;
|
||||||
|
Timer? checkThemeTimer;
|
||||||
|
Timer? getMarker;
|
||||||
String themeMode = '';
|
String themeMode = '';
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@@ -62,11 +64,17 @@ class _MapScreenState extends State<MapScreen> with WidgetsBindingObserver {
|
|||||||
_loadIcons();
|
_loadIcons();
|
||||||
getAllMarkers();
|
getAllMarkers();
|
||||||
clusterManager = _initClusterManager();
|
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
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
super.dispose();
|
super.dispose();
|
||||||
|
checkThemeTimer?.cancel();
|
||||||
|
getMarker?.cancel();
|
||||||
_controller = Completer();
|
_controller = Completer();
|
||||||
streamController.close();
|
streamController.close();
|
||||||
}
|
}
|
||||||
@@ -142,7 +150,6 @@ class _MapScreenState extends State<MapScreen> with WidgetsBindingObserver {
|
|||||||
return rootBundle.loadString(path);
|
return rootBundle.loadString(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Future<void> _loadIcons() async {
|
Future<void> _loadIcons() async {
|
||||||
List<Future<BitmapDescriptor>> iconFutures = imageAssets.map((asset) {
|
List<Future<BitmapDescriptor>> iconFutures = imageAssets.map((asset) {
|
||||||
return BitmapDescriptor.asset(
|
return BitmapDescriptor.asset(
|
||||||
|
|||||||
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"))
|
||||||
|
],
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -17,7 +17,6 @@ void main() async {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
class MyApp extends StatefulWidget {
|
class MyApp extends StatefulWidget {
|
||||||
const MyApp({super.key});
|
const MyApp({super.key});
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
|
import 'package:sfm_app/feature/sound_notification_test/notification_bloc.dart';
|
||||||
|
import 'package:sfm_app/feature/sound_notification_test/notification_screen.dart';
|
||||||
import '../../../bloc/device_detail_bloc.dart';
|
import '../../../bloc/device_detail_bloc.dart';
|
||||||
import '../../../feature/devices/device_detail/device_detail_screen.dart';
|
import '../../../feature/devices/device_detail/device_detail_screen.dart';
|
||||||
import '../../../bloc/device_notification_settings_bloc.dart';
|
import '../../../bloc/device_notification_settings_bloc.dart';
|
||||||
@@ -151,6 +153,14 @@ GoRouter goRouter() {
|
|||||||
),
|
),
|
||||||
transitionsBuilder: transitionsRightToLeft),
|
transitionsBuilder: transitionsRightToLeft),
|
||||||
),
|
),
|
||||||
|
GoRoute(
|
||||||
|
path: "/notification",
|
||||||
|
name: 'notification',
|
||||||
|
builder: (context, state) => BlocProvider(
|
||||||
|
child: const NotificationScreen(),
|
||||||
|
blocBuilder: () => NotificationBloc(),
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -433,10 +433,10 @@ packages:
|
|||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: http
|
name: http
|
||||||
sha256: "759d1a329847dd0f39226c688d3e06a6b8679668e350e2891a6474f8b4bb8525"
|
sha256: fe7ab022b76f3034adc518fb6ea04a82387620e19977665ea18d30a1cf43442f
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.1.0"
|
version: "1.3.0"
|
||||||
http_parser:
|
http_parser:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ dependencies:
|
|||||||
# flex_color_scheme: ^7.2.0
|
# flex_color_scheme: ^7.2.0
|
||||||
flex_color_scheme: ^8.1.0
|
flex_color_scheme: ^8.1.0
|
||||||
go_router: ^13.1.0
|
go_router: ^13.1.0
|
||||||
http: ^1.1.0
|
http: ^1.3.0
|
||||||
top_snackbar_flutter: ^3.1.0
|
top_snackbar_flutter: ^3.1.0
|
||||||
badges: ^3.1.2
|
badges: ^3.1.2
|
||||||
# google_maps_cluster_manager: ^3.1.0
|
# google_maps_cluster_manager: ^3.1.0
|
||||||
|
|||||||
Reference in New Issue
Block a user