Skip to content

Commit b6353d2

Browse files
committed
done
1 parent b59790e commit b6353d2

File tree

15 files changed

+185
-63
lines changed

15 files changed

+185
-63
lines changed

android/app/build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ if (flutterVersionName == null) {
2323
}
2424

2525
android {
26-
namespace "com.example.amalyot_uchun"
26+
namespace "eventsmanager.assoft.uz"
2727
compileSdkVersion flutter.compileSdkVersion
2828
ndkVersion flutter.ndkVersion
2929

@@ -42,7 +42,7 @@ android {
4242

4343
defaultConfig {
4444
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
45-
applicationId "com.example.amalyot_uchun"
45+
applicationId "eventsmanager.assoft.uz"
4646
// You can update the following values to match your application needs.
4747
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
4848
minSdkVersion 20

android/app/src/main/AndroidManifest.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
22
<uses-permission android:name="android.permission.INTERNET"/>
33
<application
4-
android:label="amalyot_uchun"
4+
android:label="EventsManager"
55
android:name="${applicationName}"
6-
android:icon="@mipmap/ic_launcher">
6+
android:icon="@mipmap/logo">
77
<activity
88
android:name=".MainActivity"
99
android:exported="true"

android/app/src/main/kotlin/com/example/amalyot_uchun/MainActivity.kt android/app/src/main/kotlin/eventsmanager/assoft/uz/MainActivity.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.example.amalyot_uchun
1+
package eventsmanager.assoft.uz
22

33
import io.flutter.embedding.android.FlutterActivity
44

2.41 KB
Loading
1.43 KB
Loading
2.8 KB
Loading
4.57 KB
Loading
6.03 KB
Loading

assets/logo.png

15.2 KB
Loading

lib/providers/appProvider.dart

+3
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ class AppProvider with ChangeNotifier {
3333
}
3434
return;
3535
} catch (e) {
36+
if (e.toString() == "Invalid email or password") {
37+
rethrow;
38+
}
3639
throw MyException(message: "Not Internet");
3740
}
3841
}

lib/screens/auth.dart

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
import 'package:amalyot_uchun/providers/appProvider.dart';
2-
import 'package:amalyot_uchun/screens/home_screen.dart';
31
import 'package:flutter/cupertino.dart';
42
import 'package:flutter/material.dart';
53
import 'package:provider/provider.dart';
64

5+
import '/providers/appProvider.dart';
6+
import '/screens/home_screen.dart';
7+
8+
79
class Auth extends StatefulWidget {
810
const Auth({super.key});
911

@@ -72,7 +74,7 @@ class _AuthState extends State<Auth> {
7274
Widget build(BuildContext context) {
7375
return Scaffold(
7476
appBar: AppBar(
75-
title: const Text("AppBar"),
77+
title: const Text("EventsManager"),
7678
centerTitle: true,
7779
),
7880
body: Padding(

lib/screens/home_screen.dart

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
1-
import 'package:amalyot_uchun/providers/appProvider.dart';
2-
import 'package:amalyot_uchun/screens/auth.dart';
3-
import 'package:amalyot_uchun/screens/scanner.dart';
41
import 'package:flutter/cupertino.dart';
52
import 'package:flutter/material.dart';
63
import 'package:provider/provider.dart';
74

5+
import '/providers/appProvider.dart';
6+
import '/screens/auth.dart';
7+
import '/screens/scanner.dart';
8+
9+
810
class Home extends StatelessWidget {
911
const Home({super.key});
1012

1113
@override
1214
Widget build(BuildContext context) {
1315
return Scaffold(
1416
appBar: AppBar(
15-
title: const Text("Home"),
17+
title: const Text("EventsManager"),
1618
centerTitle: true,
1719
actions: [
1820
IconButton(
@@ -27,7 +29,7 @@ class Home extends StatelessWidget {
2729
)
2830
],
2931
),
30-
body: const Center(child: Text("Body")),
32+
body: const Center(child: Text("Welcome")),
3133
floatingActionButton: FloatingActionButton(
3234
child: const Icon(Icons.qr_code_scanner_rounded),
3335
onPressed: () => Navigator.of(context).push(

lib/screens/scanner.dart

+55-50
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
import 'package:amalyot_uchun/providers/appProvider.dart';
2-
import 'package:amalyot_uchun/widget/wait.dart';
31
import 'package:flutter/material.dart';
42
import 'package:provider/provider.dart';
53
import 'package:qr_code_scanner/qr_code_scanner.dart';
64

5+
import '../providers/appProvider.dart';
6+
import '../widget/wait.dart';
7+
78
class ScannerScreen extends StatefulWidget {
89
const ScannerScreen({super.key});
910

@@ -30,7 +31,6 @@ class _ScannerScreenState extends State<ScannerScreen> {
3031
var user =
3132
await Provider.of<AppProvider>(ctx, listen: false).getUser(userId);
3233

33-
3434
// ignore: use_build_context_synchronously
3535
Navigator.of(ctx).pop();
3636
if (user['status'] != 200) {
@@ -47,7 +47,10 @@ class _ScannerScreenState extends State<ScannerScreen> {
4747
isScanned = false;
4848
});
4949
},
50-
child: const Text("Close"),
50+
child: const Text(
51+
"Close",
52+
style: TextStyle(color: Colors.red),
53+
),
5154
),
5255
],
5356
),
@@ -57,12 +60,13 @@ class _ScannerScreenState extends State<ScannerScreen> {
5760
String access = "";
5861
user['msg']['access'] == null ? access = "yo'q" : access = "bor";
5962
var userData =
60-
"${user['msg']['comes']}!\nIshtrokch: ${user['msg']['name']} ${user['msg']['surname']}\nJamo: ${user['msg']['firm']}\nRuxsat $access";
63+
"Ishtrokch: ${user['msg']['name']} ${user['msg']['surname']}\nFirma: ${user['msg']['firm']}\nRuxsat $access";
6164
// ignore: use_build_context_synchronously
6265
showDialog(
6366
context: ctx,
6467
builder: (ctx1) => AlertDialog(
6568
content: Text(userData),
69+
actionsAlignment: MainAxisAlignment.center,
6670
actions: [
6771
ElevatedButton(
6872
onPressed: () {
@@ -71,36 +75,36 @@ class _ScannerScreenState extends State<ScannerScreen> {
7175
isScanned = false;
7276
});
7377
},
74-
child: const Text("Close"),
78+
child: const Text("Close", style: TextStyle(color: Colors.red)),
7579
),
76-
ElevatedButton(
77-
onPressed: () {
78-
Navigator.of(ctx1).pop();
79-
WaitWidget(ctx);
80-
81-
Provider.of<AppProvider>(ctx1, listen: false)
82-
.acceptUser(userId)
83-
.then((value) => ScaffoldMessenger.of(context).showSnackBar(
84-
const SnackBar(
85-
content: Text("Successful"),
86-
),
87-
)
88-
89-
80+
if (access != "bor")
81+
ElevatedButton(
82+
onPressed: () {
83+
Navigator.of(ctx1).pop();
84+
WaitWidget(ctx);
9085

91-
).onError((error, stackTrace) =>ScaffoldMessenger.of(context).showSnackBar(
92-
const SnackBar(
93-
content: Text("Bad! 404 error"),
94-
),
95-
));
86+
Provider.of<AppProvider>(ctx1, listen: false)
87+
.acceptUser(userId)
88+
.then((value) => ScaffoldMessenger.of(context).showSnackBar(
89+
const SnackBar(
90+
content: Text("Successful"),
91+
),
92+
))
93+
.onError((error, stackTrace) =>
94+
ScaffoldMessenger.of(context).showSnackBar(
95+
const SnackBar(
96+
content: Text("Bad! 404 error"),
97+
),
98+
));
9699

97-
setState(() {
98-
isScanned = false;
99-
});
100-
Navigator.of(ctx).pop();
101-
},
102-
child: const Text("Accept"),
103-
),
100+
setState(() {
101+
isScanned = false;
102+
});
103+
Navigator.of(ctx).pop();
104+
},
105+
child:
106+
const Text("Access", style: TextStyle(color: Colors.green)),
107+
),
104108
],
105109
),
106110
);
@@ -123,24 +127,25 @@ class _ScannerScreenState extends State<ScannerScreen> {
123127
@override
124128
Widget build(BuildContext context) {
125129
return Scaffold(
126-
appBar: AppBar(
127-
title: const Text("QR scanner"),
128-
centerTitle: true,
130+
appBar: AppBar(
131+
title: const Text("QR scanner"),
132+
centerTitle: true,
133+
),
134+
body: Center(
135+
child: Column(
136+
mainAxisSize: MainAxisSize.min,
137+
children: [
138+
SizedBox(
139+
width: 250,
140+
height: 250,
141+
child: QRView(
142+
key: qrKey,
143+
onQRViewCreated: (c) => qr(c, context),
144+
),
145+
)
146+
],
129147
),
130-
body: Center(
131-
child: Column(
132-
mainAxisSize: MainAxisSize.min,
133-
children: [
134-
SizedBox(
135-
width: 250,
136-
height: 250,
137-
child: QRView(
138-
key: qrKey,
139-
onQRViewCreated: (c) => qr(c, context),
140-
),
141-
)
142-
],
143-
),
144-
));
148+
),
149+
);
145150
}
146151
}

0 commit comments

Comments
 (0)