Skip to content

Commit 74f622e

Browse files
committed
quiz theme updated
1 parent 2dcfe92 commit 74f622e

18 files changed

+621
-435
lines changed

android/build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ buildscript {
66
}
77

88
dependencies {
9-
classpath 'com.android.tools.build:gradle:4.1.0'
9+
classpath 'com.android.tools.build:gradle:7.3.0'
1010
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1111
}
1212
}
@@ -26,6 +26,6 @@ subprojects {
2626
project.evaluationDependsOn(':app')
2727
}
2828

29-
task clean(type: Delete) {
29+
tasks.register("clean", Delete) {
3030
delete rootProject.buildDir
3131
}
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
#Fri Jun 23 08:50:38 CEST 2017
21
distributionBase=GRADLE_USER_HOME
32
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip

lib/constant/constant.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
const base_url = 'https://quizlearn.noonedev.com';
2-
// const base_url = 'http://192.168.146.109/quizearn/public';
1+
// const base_url = 'https://quizlearn.noonedev.com';
2+
const base_url = 'http://192.168.1.5/quize_beckendV2/public';
33
Map userData = {};

lib/constant/feedbackCard.dart

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import 'package:flutter/material.dart';
22

3-
GestureDetector feedbackCard(String txt, VoidCallback onPressed,
3+
GestureDetector feedbackCard(
4+
String txt, VoidCallback onPressed, BuildContext context,
45
{selectedCard = false}) {
56
return GestureDetector(
67
onTap: onPressed,

lib/main.dart

+25-20
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,21 @@
11
import 'package:provider/provider.dart';
22
import 'package:quiz_earn/helper/helper.dart';
3+
import 'package:quiz_earn/providers/themeprovider.dart';
34
import 'package:quiz_earn/providers/userprovider.dart';
45
import 'package:quiz_earn/views/signin.dart';
56
import 'package:quiz_earn/views/subjects.dart';
67
import 'package:flutter/material.dart';
78
import 'package:flutter_downloader/flutter_downloader.dart';
9+
import 'package:responsive_sizer/responsive_sizer.dart';
810

911
void main() async {
1012
WidgetsFlutterBinding.ensureInitialized();
1113
await FlutterDownloader.initialize();
1214
runApp(MultiProvider(
13-
providers: [ChangeNotifierProvider(create: (_) => User())],
15+
providers: [
16+
ChangeNotifierProvider(create: (_) => User()),
17+
ChangeNotifierProvider(create: (_) => ThemeProviders())
18+
],
1419
child: MyApp(),
1520
));
1621
}
@@ -51,24 +56,24 @@ class _MyAppState extends State<MyApp> {
5156

5257
@override
5358
Widget build(BuildContext context) {
54-
return MaterialApp(
55-
title: 'Quiz Learn',
56-
debugShowCheckedModeBanner: false,
57-
theme: ThemeData(
58-
visualDensity: VisualDensity.adaptivePlatformDensity,
59-
),
60-
home: isLoading
61-
? Container(
62-
color: Colors.white,
63-
child: Center(
64-
child: CircularProgressIndicator(),
65-
),
66-
)
67-
: _isLoggedIn
68-
? Subjects(
69-
message: '',
70-
)
71-
: SignIn(),
72-
);
59+
return ResponsiveSizer(builder: (context, orientation, screenType) {
60+
return MaterialApp(
61+
title: 'Quiz Learn',
62+
debugShowCheckedModeBanner: false,
63+
theme: Provider.of<ThemeProviders>(context).themeData,
64+
home: isLoading
65+
? Container(
66+
color: Colors.white,
67+
child: Center(
68+
child: CircularProgressIndicator(),
69+
),
70+
)
71+
: _isLoggedIn
72+
? Subjects(
73+
message: '',
74+
)
75+
: SignIn(),
76+
);
77+
});
7378
}
7479
}

lib/models/theme_model.dart

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// ignore_for_file: public_member_api_docs, sort_constructors_first
2+
import 'dart:convert';
3+
4+
class ThemeModel {
5+
int id;
6+
String seed_color;
7+
String primary_color;
8+
String secondary_color;
9+
String tertiary_color;
10+
ThemeModel({
11+
required this.id,
12+
required this.seed_color,
13+
required this.primary_color,
14+
required this.secondary_color,
15+
required this.tertiary_color,
16+
});
17+
18+
Map<String, dynamic> toMap() {
19+
return <String, dynamic>{
20+
'id': id,
21+
'seed_color': seed_color,
22+
'primary_color': primary_color,
23+
'secondary_color': secondary_color,
24+
'tertiary_color': tertiary_color,
25+
};
26+
}
27+
28+
factory ThemeModel.fromMap(Map<String, dynamic> map) {
29+
return ThemeModel(
30+
id: map['id'] as int,
31+
seed_color: map['seed_color'] as String,
32+
primary_color: map['primary_color'] as String,
33+
secondary_color: map['secondary_color'] as String,
34+
tertiary_color: map['tertiary_color'] as String,
35+
);
36+
}
37+
38+
String toJson() => json.encode(toMap());
39+
40+
factory ThemeModel.fromJson(String source) =>
41+
ThemeModel.fromMap(json.decode(source) as Map<String, dynamic>);
42+
}

lib/providers/themeprovider.dart

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import 'package:flutter/material.dart';
2+
3+
class ThemeProviders extends ChangeNotifier {
4+
int _theme_number = 0;
5+
6+
List<ThemeData> themes = [
7+
ThemeData.dark(useMaterial3: true),
8+
ThemeData.light(useMaterial3: true),
9+
];
10+
ThemeData get themeData => themes[_theme_number];
11+
int get theme_number => _theme_number;
12+
13+
updateTheme(int themeNumber) {
14+
_theme_number = themeNumber;
15+
notifyListeners();
16+
}
17+
}

lib/views/change_pass.dart

-4
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,7 @@ class _ChangePassState extends State<ChangePass> {
121121
title: Center(
122122
child: Text(
123123
"Quiz Learn",
124-
style: TextStyle(color: Colors.blue, fontSize: 24),
125124
)),
126-
iconTheme: IconThemeData(color: Colors.black),
127-
backgroundColor: Colors.transparent,
128-
elevation: 0.0,
129125
),
130126
body: isLoading
131127
? Container(

lib/views/feedback.dart

+6-12
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ class _FeedbackScreanState extends State<FeedbackScrean> {
6969
bottomNavigationBar: isLoading
7070
? null
7171
: Container(
72-
color: Colors.white,
7372
padding: EdgeInsets.symmetric(horizontal: 20, vertical: 30),
7473
child: LoadingElevatedButton(
7574
isLoading: isSubmit,
@@ -86,7 +85,7 @@ class _FeedbackScreanState extends State<FeedbackScrean> {
8685
shape: MaterialStateProperty.all<RoundedRectangleBorder>(
8786
RoundedRectangleBorder(
8887
borderRadius: BorderRadius.circular(10),
89-
side: BorderSide(color: Colors.blue),
88+
side: BorderSide(),
9089
),
9190
),
9291
),
@@ -99,10 +98,7 @@ class _FeedbackScreanState extends State<FeedbackScrean> {
9998
elevation: 1,
10099
title: Text(
101100
'Feedback',
102-
style: TextStyle(color: Colors.black, fontSize: 22),
103101
),
104-
iconTheme: IconThemeData(color: Colors.black),
105-
backgroundColor: Colors.white,
106102
),
107103
body: isLoading
108104
? SubmitedFeedbackScreen()
@@ -116,7 +112,6 @@ class _FeedbackScreanState extends State<FeedbackScrean> {
116112
width: MediaQuery.of(context).size.width,
117113
padding:
118114
EdgeInsets.symmetric(horizontal: 24, vertical: 16),
119-
color: Colors.white,
120115
child: Column(
121116
crossAxisAlignment: CrossAxisAlignment.start,
122117
children: [
@@ -169,7 +164,6 @@ class _FeedbackScreanState extends State<FeedbackScrean> {
169164
}
170165
return Icon(
171166
Icons.sentiment_satisfied,
172-
color: Colors.white,
173167
);
174168
},
175169
onRatingUpdate: (value) {
@@ -186,7 +180,6 @@ class _FeedbackScreanState extends State<FeedbackScrean> {
186180
padding:
187181
EdgeInsets.symmetric(horizontal: 24, vertical: 16),
188182
margin: EdgeInsets.symmetric(vertical: 16),
189-
color: Colors.white,
190183
child: Column(
191184
crossAxisAlignment: CrossAxisAlignment.start,
192185
children: [
@@ -215,6 +208,7 @@ class _FeedbackScreanState extends State<FeedbackScrean> {
215208
});
216209
}
217210
},
211+
context,
218212
selectedCard:
219213
selectedList.contains(1) ? true : false,
220214
),
@@ -231,6 +225,7 @@ class _FeedbackScreanState extends State<FeedbackScrean> {
231225
});
232226
}
233227
},
228+
context,
234229
selectedCard:
235230
selectedList.contains(2) ? true : false,
236231
),
@@ -247,6 +242,7 @@ class _FeedbackScreanState extends State<FeedbackScrean> {
247242
});
248243
}
249244
},
245+
context,
250246
selectedCard:
251247
selectedList.contains(3) ? true : false,
252248
),
@@ -271,6 +267,7 @@ class _FeedbackScreanState extends State<FeedbackScrean> {
271267
});
272268
}
273269
},
270+
context,
274271
selectedCard:
275272
selectedList.contains(5) ? true : false,
276273
),
@@ -294,11 +291,8 @@ class _FeedbackScreanState extends State<FeedbackScrean> {
294291
hintStyle: TextStyle(
295292
fontSize: 14,
296293
),
297-
fillColor: Colors.white,
298294
focusedBorder: OutlineInputBorder(
299-
borderSide: BorderSide(
300-
color: Colors.blue,
301-
),
295+
borderSide: BorderSide(),
302296
),
303297
enabledBorder: OutlineInputBorder(
304298
borderSide: BorderSide(),

lib/views/home.dart

-4
Original file line numberDiff line numberDiff line change
@@ -190,11 +190,7 @@ class _HomeState extends State<Home> {
190190
title: Center(
191191
child: Text(
192192
widget.subject_name,
193-
style: TextStyle(color: Colors.blue, fontSize: 24),
194193
)),
195-
iconTheme: IconThemeData(color: Colors.black),
196-
backgroundColor: Colors.transparent,
197-
elevation: 0.0,
198194
actions: <Widget>[
199195
IconButton(
200196
tooltip: 'Refresh',

lib/views/myaccount.dart

+10-3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import 'package:quiz_earn/views/update_details.dart';
66
import 'package:dio/dio.dart';
77
import 'package:flutter/material.dart';
88
import 'package:ndialog/ndialog.dart';
9+
import 'package:responsive_sizer/responsive_sizer.dart';
910

1011
import '../widget/drawer.dart';
1112

@@ -120,10 +121,7 @@ class _MyAccountState extends State<MyAccount> {
120121
appBar: AppBar(
121122
title: Text(
122123
'My Account',
123-
style: TextStyle(color: Colors.blueAccent, fontSize: 22),
124124
),
125-
iconTheme: IconThemeData(color: Colors.black),
126-
backgroundColor: Colors.white,
127125
),
128126
drawer: appDrawer(context),
129127
body: isLoading
@@ -133,6 +131,15 @@ class _MyAccountState extends State<MyAccount> {
133131
padding: EdgeInsets.all(20),
134132
child: Column(
135133
children: [
134+
Container(
135+
child: Card(
136+
shape: CircleBorder(),
137+
child: Icon(
138+
Icons.person_rounded,
139+
// size: 20.sp,
140+
),
141+
),
142+
),
136143
Center(
137144
child: Icon(
138145
Icons.person_rounded,

lib/views/play_quiz.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -425,8 +425,8 @@ class _QuizPlayTileState extends State<QuizPlayTile>
425425
child: Html(
426426
shrinkWrap: true,
427427
data: "Q${widget.page + 1} " + widget.questionModel.question,
428-
onImageTap: (String? url, RenderContext context,
429-
Map<String, String> attributes, dom.Element? element) async {
428+
onLinkTap: (String? url, Map<String, String> attributes,
429+
dom.Element? element) async {
430430
url = url as String;
431431
await ZoomDialog(
432432
zoomScale: 5,

lib/views/played_quiz.dart

+2-7
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ class _PlayedQuizState extends State<PlayedQuiz> {
2828
late Future getDataFun;
2929
final formKey = GlobalKey<FormState>();
3030

31-
static void downloadCallback(
32-
String id, DownloadTaskStatus status, int progress) {
31+
static void downloadCallback(String id, int status, int progress) {
3332
final SendPort? send =
3433
IsolateNameServer.lookupPortByName('downloader_send_port');
3534
send!.send([id, status, progress]);
@@ -236,12 +235,9 @@ class _PlayedQuizState extends State<PlayedQuiz> {
236235
Widget build(BuildContext context) {
237236
return Scaffold(
238237
appBar: AppBar(
239-
title: Text(
238+
title: const Text(
240239
'Results',
241-
style: TextStyle(color: Colors.blueAccent, fontSize: 22),
242240
),
243-
iconTheme: IconThemeData(color: Colors.black),
244-
backgroundColor: Colors.white,
245241
actions: [
246242
GestureDetector(
247243
onTap: () async {
@@ -440,7 +436,6 @@ class _PlayedQuizState extends State<PlayedQuiz> {
440436
final status = await Permission.storage.request();
441437
if (!status.isGranted) {
442438
// ignore: avoid_print
443-
444439
} else {
445440
final exterdir = await getDownloadPath();
446441
final exterdir2 =

0 commit comments

Comments
 (0)