Commit e2657fa9 by Ramesh Babu Puvvadi

added changes

parent a96d8a62
......@@ -46,7 +46,10 @@ class _CameraGridItemsState extends State<CameraGridItems> {
onTap: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => MyHomePage()),
MaterialPageRoute(
builder: (context) => MyHomePage(
message: '',
)),
);
},
child: Container(
......
import 'dart:convert';
import 'package:flutter/foundation.dart';
import 'package:intl/intl.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
......@@ -229,7 +230,7 @@ class _CheckList extends State<CheckList> {
),
const SizedBox(width: 8),
SizedBox(
width: 60, // Adjust the width as needed
width: 60, //Adjust the width as needed
child: TextFormField(
controller: six,
keyboardType: TextInputType.number,
......@@ -250,7 +251,7 @@ class _CheckList extends State<CheckList> {
),
const SizedBox(width: 8),
SizedBox(
width: 60, // Adjust the width as needed
width: 60, //Adjust the width as needed
child: TextFormField(
controller: seven,
keyboardType: TextInputType.number,
......@@ -404,6 +405,7 @@ class _CheckList extends State<CheckList> {
color: Color.fromARGB(255, 173, 57, 230),
));
});
List<Map<String, dynamic>> jsonArray = [
{
'hour': '10-11',
......@@ -462,8 +464,14 @@ class _CheckList extends State<CheckList> {
'${_selectedDate.year}/${_selectedDate.month}/${_selectedDate.day}');
Map<String, dynamic> responseMap =
jsonDecode(res!.body);
if (kDebugMode) {
print(responseMap);
}
if (responseMap['status'] == 'Success') {
Navigator.pop(context);
Constants('Footfall Verification',
responseMap['status'])
.showAlertDialog(context, false);
setState(() {
one.text = '';
two.text = '';
......@@ -480,9 +488,13 @@ class _CheckList extends State<CheckList> {
});
} else {
Navigator.pop(context);
Constants('Footfall Verification',
responseMap['status'])
.showAlertDialog(context, false);
}
} else {
Constants('CheckList', 'Enter Atleast one item').showAlertDialog(context, false);
Constants('CheckList', 'Enter Atleast one item')
.showAlertDialog(context, false);
}
}
},
......
......@@ -253,7 +253,7 @@ class Constants {
showAlertDialog(BuildContext context, bool val) {
Widget okButton = TextButton(
child: const Text("Cancel"),
child: const Text("Ok"),
onPressed: () {
if (val) {
Navigator.popUntil(context, (route) => route.isFirst);
......
......@@ -73,7 +73,8 @@ class _EmployeeReport extends State<EmployeeReport> {
),
),
),
body: Container(
body: SingleChildScrollView(
child: Container(
margin: const EdgeInsets.all(15.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
......@@ -174,7 +175,8 @@ class _EmployeeReport extends State<EmployeeReport> {
' Registered :',
style: Constants.headerlistitems,
),
Text(' $registered', style: Constants.headerlistitems1),
Text(' $registered',
style: Constants.headerlistitems1),
],
),
const SizedBox(width: 1, height: 10),
......@@ -255,7 +257,7 @@ class _EmployeeReport extends State<EmployeeReport> {
),
),
SizedBox(
height: MediaQuery.of(context).size.height * 0.42,
height: MediaQuery.of(context).size.height * 0.48,
child: ListView.builder(
itemCount: empreportlist?.length,
itemBuilder: (context, index) {
......@@ -372,6 +374,7 @@ class _EmployeeReport extends State<EmployeeReport> {
],
),
),
),
);
}
......@@ -388,7 +391,7 @@ class _EmployeeReport extends State<EmployeeReport> {
);
},
);
}
}
Future<void> getupdateData(String? selectedDropdownItem) async {
if (await Constants.checkInternetConnectivity()) {
......@@ -429,7 +432,8 @@ class _EmployeeReport extends State<EmployeeReport> {
});
} else {
Navigator.of(context).pop();
Constants('Employee Report', 'Please check your internet connection').showAlertDialog(context, false);
Constants('Employee Report', 'Please check your internet connection')
.showAlertDialog(context, false);
}
}
}
......@@ -148,17 +148,7 @@ class _FootFall extends State<FootFall> {
onHorizontalDragStart: (details) {
print('force press start');
},
onHorizontalDragDown: (details) {
print('force press down');
//if (details.globalPosition.direction > 0) {
// print('force press down1$details');
//}
//if (details.globalPosition.direction < 0) {
// print('force press down$details');
//}
//Navigator.of(context).pop();
},
onHorizontalDragDown: (details) {},
child: FutureBuilder<Foot?>(
future: _futureFoot,
builder: (context, snapshot) {
......@@ -403,6 +393,13 @@ class _FootFall extends State<FootFall> {
style: Constants.listitems,
),
),
Expanded(
child: Text(
'MTeens',
textAlign: TextAlign.center,
style: Constants.listitems,
),
),
],
),
const SizedBox(
......@@ -454,17 +451,17 @@ class _FootFall extends State<FootFall> {
),
),
),
// Expanded(
// child: Text(
// foot.mteens.toString(),
// textAlign: TextAlign.center,
// style: const TextStyle(
// color:
// Color.fromARGB(255, 63, 123, 173),
// fontWeight: FontWeight.bold,
// ),
// ),
// ),
Expanded(
child: Text(
foot.mteens.toString(),
textAlign: TextAlign.center,
style: const TextStyle(
color: Color.fromARGB(
255, 63, 123, 173),
fontWeight: FontWeight.bold,
),
),
),
],
),
const SizedBox(
......@@ -517,16 +514,17 @@ class _FootFall extends State<FootFall> {
),
),
),
// Expanded(
// child: Text(
// foot.fteens.toString(),
// textAlign: TextAlign.center,
// style: const TextStyle(
// color: Color.fromARGB(255, 235, 25, 42),
// fontWeight: FontWeight.bold,
// ),
// ),
// ),
Expanded(
child: Text(
foot.fteens.toString(),
textAlign: TextAlign.center,
style: const TextStyle(
color: Color.fromARGB(
255, 235, 25, 42),
fontWeight: FontWeight.bold,
),
),
),
],
),
const SizedBox(
......
......@@ -6,9 +6,9 @@ import 'package:shared_preferences/shared_preferences.dart';
import 'package:storemonitor/Models/chartdata.dart';
import 'package:storemonitor/Screens/EmployeeStatus.dart';
import 'package:storemonitor/Screens/IssueVideos.dart';
import 'package:storemonitor/Screens/MyHomePage.dart';
import 'package:storemonitor/Screens/NavBar.dart';
import 'package:intl/intl.dart';
import 'package:storemonitor/Screens/WeeklyAudit.dart';
import 'package:storemonitor/Services/RemoteData.dart';
import 'package:syncfusion_flutter_charts/charts.dart';
import 'Constants.dart';
......@@ -27,6 +27,7 @@ class Home extends StatefulWidget {
class _Home extends State<Home> {
String? selectedDropdownItem;
String? empId;
List<String>? namesList;
late List<GDPData> _chartData;
DateTime _selectedDate = DateTime.now();
......@@ -46,6 +47,8 @@ class _Home extends State<Home> {
loadData() async {
SharedPreferences prefs = await SharedPreferences.getInstance();
String? userId = prefs.getString("stores_list");
empId = prefs.getString('empId');
print(empId);
namesList = (json.decode(userId!) as List<dynamic>)
.map((map) => map['name'] as String)
.toList();
......@@ -647,9 +650,10 @@ class _Home extends State<Home> {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => WeeklyAudit(
builder: (context) => MyHomePage(
message:
selectedDropdownItem.toString())));
'https://vaman.plutokm.com/sa_mob_report/$empId',
)));
},
child: Container(
width: MediaQuery.of(context).size.width * 0.44,
......
......@@ -2,7 +2,6 @@ import 'dart:convert';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:permission_handler/permission_handler.dart';
//import 'package:need_resume/need_resume.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:storemonitor/Screens/Issue.dart';
import 'package:storemonitor/Screens/SurvellianceView.dart';
......@@ -36,10 +35,14 @@ class _IssueVideos extends State<IssueVideos> {
Future<void> requestStoragePermission() async {
final status = await Permission.storage.request();
if (status.isGranted) {
if (kDebugMode) {
print('Granted');
}
// You have the permission, you can now access storage.
} else if (status.isDenied) {
if (kDebugMode) {
print('Not Granted');
}
// The user denied the permission. You can explain why you need it and request again.
} else if (status.isPermanentlyDenied) {
// The user permanently denied the permission. You can open the app settings to let the user manually enable it.
......@@ -65,6 +68,9 @@ class _IssueVideos extends State<IssueVideos> {
}
void getData(String name) async {
if (kDebugMode) {
print("Second Class Hitting");
}
bool isInternetConnected = await Constants.checkInternetConnectivity();
if (isInternetConnected) {
showDialog(
......@@ -119,7 +125,8 @@ class _IssueVideos extends State<IssueVideos> {
),
),
),
body: Container(
body: SingleChildScrollView(
child: Container(
margin: const EdgeInsets.all(15.0),
child: Column(
//crossAxisAlignment: CrossAxisAlignment.center,
......@@ -260,35 +267,30 @@ class _IssueVideos extends State<IssueVideos> {
child: GestureDetector(
onTap: () {
requestStoragePermission();
Navigator.of(context)
.push(
Navigator.push(
context,
MaterialPageRoute(
builder: (_) => SurvellianceView(
message: notificationslist![index]
.VIDEOURL,
builder: (context) => SurvellianceView(
message:
notificationslist![index].VIDEOURL,
id: notificationslist![index]
.VIDNOTID
.toString(),
comment: notificationslist![index]
.COMMENTS,
comment:
notificationslist![index].COMMENTS,
desc: notificationslist![index]
.DESCRIPTION,
store:
notificationslist![index].STORE,
location: notificationslist![index]
.LOCATION,
time: notificationslist![index]
.TIMESTAMP,
store: notificationslist![index].STORE,
location:
notificationslist![index].LOCATION,
time:
notificationslist![index].TIMESTAMP,
)),
)
.then((val) => (val != null)
? (val
? getData(selectedDropdownItem!)
: true)
: false);
// Navigator.of(context).push(MaterialPageRoute(
// builder: (_) => MyHomePage()));
).then((value) => setState(() {
getData(selectedDropdownItem!);
}));
print("refresh done ");
},
child: Row(
children: [
......@@ -310,7 +312,9 @@ class _IssueVideos extends State<IssueVideos> {
),
Expanded(
child: Text(
notificationslist![index].TIMESTAMP.toString(),
notificationslist![index]
.TIMESTAMP
.toString(),
textAlign: TextAlign.center,
style: Constants.headerlistitems1,
),
......@@ -320,8 +324,9 @@ class _IssueVideos extends State<IssueVideos> {
color: Colors.white,
),
Expanded(
child:
notificationslist![index].STATUS.toString() ==
child: notificationslist![index]
.STATUS
.toString() ==
'CLOSED'
? const Text(
'VIEWED',
......@@ -469,6 +474,7 @@ class _IssueVideos extends State<IssueVideos> {
],
),
),
),
);
}
}
import 'package:chewie/chewie.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:storemonitor/Screens/Constants.dart';
import 'package:video_player/video_player.dart';
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key});
final String message;
const MyHomePage({super.key, required this.message});
@override
_VideoPlayerScreenState createState() => _VideoPlayerScreenState();
}
class _VideoPlayerScreenState extends State<MyHomePage> {
late VideoPlayerController _videoPlayerController;
late ChewieController _chewieController;
var isMeeters = '';
InAppWebViewController? webViewController;
String? userId = '';
//double _scale = 1.0;
String? url = 'http://192.168.65.111:8100/restream';
String? urlData =
'https://www.flutterdecode.com/play-video-from-url-in-flutter';
//String? url = 'http://192.168.65.111:8100/restream';
String urlData = '';
@override
void initState() {
super.initState();
isMeeters = widget.message;
//getLoadData();
}
Future<void> getLoadData() async {
SharedPreferences prefs = await SharedPreferences.getInstance();
userId = prefs.getString('empId');
urlData = 'https://vaman.plutokm.com/sa_mob_report/$userId';
//await Future.delayed(Duration(seconds: 1));
if (kDebugMode) {
print(urlData);
}
}
@override
void dispose() {
super.dispose();
_videoPlayerController.dispose();
_chewieController.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
// leading: IconButton(
// icon: const Icon(Icons.arrow_back),
// onPressed: () async {
// Navigator.pop(context, true);
// },
// ),
title: const Text(
'Video Playing',
'Weekly Report',
style: Constants.fontStyle,
),
flexibleSpace: Container(
......@@ -52,11 +57,12 @@ class _VideoPlayerScreenState extends State<MyHomePage> {
),
),
),
body: SizedBox(
height: MediaQuery.of(context).size.height,
child: InAppWebView(
initialUrlRequest: URLRequest(
url: Uri.parse("http://192.168.65.111:8100"),
url: Uri.parse(isMeeters),
),
onWebViewCreated: (controller) {
webViewController = controller;
......@@ -77,29 +83,23 @@ class _VideoPlayerScreenState extends State<MyHomePage> {
}
// class VideoStream extends StatefulWidget {
// const VideoStream({Key? key}) : super(key: key);
// @override
// State<VideoStream> createState() => _VideoStreamState();
// }
// class _VideoStreamState extends State<VideoStream> {
// }// class _VideoStreamState extends State<VideoStream> {
// final WebSocket _socket = WebSocket('http://192.168.65.111:8100/restream');
// bool _isConnected = false;
// void connect(BuildContext context) async {
// _socket.connect();
// setState(() {
// _isConnected = true;
// });
// }
// void disconnect() {
// _socket.disconnect();
// setState(() {
// _isConnected = false;
// });
// }
// @override
// Widget build(BuildContext context) {
// return Scaffold(
......@@ -136,7 +136,6 @@ class _VideoPlayerScreenState extends State<MyHomePage> {
// if (!snapshot.hasData) {
// return const CircularProgressIndicator();
// }
// if (snapshot.connectionState == ConnectionState.done) {
// return const Center(
// child: Text("Connection Closed !"),
......
......@@ -170,6 +170,14 @@ class _Review extends State<Review> {
Navigator.of(context).pop();
Constants('Review', data.statusCode.toString())
.showAlertDialog(context, false);
setState(() {
filteredAlerts?.clear();
if (filteredAlerts!.isNotEmpty) {
_controller.text = '${1}/${filteredAlerts?.length ?? 0}';
} else {
_controller.text = '${0}/${filteredAlerts?.length ?? 0}';
}
});
}
} else {}
}
......
......@@ -39,7 +39,6 @@ class _SurvellianceViewState extends State<SurvellianceView> {
var location = '';
var des = '';
var time = '';
//late VlcPlayerController? controller;
final TextEditingController _textFieldController3 = TextEditingController();
final _focusNode = FocusNode();
......@@ -53,17 +52,13 @@ class _SurvellianceViewState extends State<SurvellianceView> {
}
void initilize(String url) {
_videoPlayerController = VideoPlayerController.networkUrl(
Uri.parse(url),
);
_videoPlayerController = VideoPlayerController.networkUrl(Uri.parse(url));
_chewieController = ChewieController(
videoPlayerController: _videoPlayerController,
aspectRatio: 16 / 9, // Set your desired aspect ratio
autoPlay: true,
looping: false, // Set to true if you want the video to loop
// Other customization options can be set here
showControls: true, // Show video controls
// Other customization options can be set here
materialProgressColors: ChewieProgressColors(
playedColor:
const Color.fromARGB(255, 205, 96, 196), // Change played color
......@@ -105,7 +100,7 @@ class _SurvellianceViewState extends State<SurvellianceView> {
final respon = await RemoteData().getUpdateIssueVideos1(Id, comment);
Map<String, dynamic> responseMap = jsonDecode(respon);
Navigator.of(context).pop();
hideKeyboard(context);
if (responseMap['status'] == 'Updated') {
Constants.dialogMessage(context, 'Video Playing', responseMap['status']);
//Navigator.of(context).pop();
......@@ -120,7 +115,6 @@ class _SurvellianceViewState extends State<SurvellianceView> {
void hideKeyboard(BuildContext context) {
// Use FocusScope to find the current FocusNode
final currentFocus = FocusScope.of(context);
// Unfocus the current FocusNode to hide the keyboard
if (!currentFocus.hasPrimaryFocus) {
currentFocus.unfocus();
......@@ -169,35 +163,6 @@ class _SurvellianceViewState extends State<SurvellianceView> {
width: 1,
height: 15,
),
// SizedBox(
// width: 90,
// height: 40,
// child: ElevatedButton(
// onPressed: () {
// setState(() {
// _isPlaying = !_isPlaying;
// if (_isPlaying) {
// controller!.play();
// } else {
// controller!.pause();
// }
// });
// },
// style: ButtonStyle(
// backgroundColor: MaterialStateProperty.all<Color>(
// const Color.fromARGB(255, 35, 22, 66)),
// ),
// child: Text(_isPlaying ? 'Pause' : 'Play'),
// ),
// ),
// Center(
// child: isLoading
// ? const CircularProgressIndicator(
// color: Color.fromARGB(255, 173, 57, 230),
// )
// : const Text(''),
// ),
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
......@@ -208,12 +173,9 @@ class _SurvellianceViewState extends State<SurvellianceView> {
width: 10,
height: 1,
),
Text(id,
style: Constants.listHeaderoppfontStyle,
overflow: TextOverflow.ellipsis),
//isvisible =false;
],
),
const SizedBox(height: 10.0),
......@@ -227,12 +189,9 @@ class _SurvellianceViewState extends State<SurvellianceView> {
width: 10,
height: 1,
),
Text(store,
style: Constants.listHeaderoppfontStyle,
overflow: TextOverflow.ellipsis),
//isvisible =false;
],
),
const SizedBox(height: 10.0),
......@@ -254,10 +213,6 @@ class _SurvellianceViewState extends State<SurvellianceView> {
style: Constants.listHeaderoppfontStyle,
),
),
// Text(location,
// textAlign: TextAlign.right,
// style: Constants.listHeaderoppfontStyle,
// overflow: TextOverflow.ellipsis),
],
),
const SizedBox(height: 10.0),
......@@ -358,7 +313,6 @@ class _SurvellianceViewState extends State<SurvellianceView> {
color:
Color.fromARGB(255, 173, 57, 230)));
});
//getUpdate(id, _textFieldController3.text);
getUpdate1(id, _textFieldController3.text);
} else {
......
......@@ -88,9 +88,9 @@ class _CheckBoxListState extends State<WeeklyAudit> {
),
),
Padding(
padding: EdgeInsets.symmetric(horizontal: 20),
padding: EdgeInsets.symmetric(horizontal: 10),
child: Text(
' Audited?',
'Audited?',
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
......@@ -102,7 +102,7 @@ class _CheckBoxListState extends State<WeeklyAudit> {
),
),
body: ListView(
padding: const EdgeInsets.fromLTRB(4, 2, 20, 4),
padding: const EdgeInsets.fromLTRB(4, 2, 10, 4),
children: List<Widget>.generate(_items.length, (index) {
final SimpleModel item = _items[index];
final Color backgroundColor = index % 2 == 0
......
......@@ -5,6 +5,7 @@ import 'package:storemonitor/FirebaseApi.dart';
import 'Screens/SplashScreen.dart';
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
if (Platform.isAndroid) {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp();
......@@ -12,7 +13,6 @@ Future<void> main() async {
}
runApp(const MaterialApp(
debugShowCheckedModeBanner: false,
home: SplashScreen(),
)
home: SplashScreen(),)
);
}
Markdown is supported
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