Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
harishanbalagan committed Oct 20, 2021
2 parents 6f47c99 + f83803d commit 3ba8a1d
Show file tree
Hide file tree
Showing 6 changed files with 378 additions and 351 deletions.
32 changes: 27 additions & 5 deletions lib/views/admin/screens/upload_profile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:image_cropper/image_cropper.dart';
import 'package:image_picker/image_picker.dart';
import 'package:intl/intl.dart';
import 'package:student_app/models.dart';

class UploadProfile extends StatefulWidget {
Expand Down Expand Up @@ -35,7 +36,7 @@ class _UploadProfile extends State<UploadProfile> {
List<Contents> year = [];
List<Contents> department = [];
List<Contents> classes = [];

TextEditingController dobController = TextEditingController();
DatabaseReference obj = DatabaseReference();

@override
Expand Down Expand Up @@ -176,6 +177,7 @@ class _UploadProfile extends State<UploadProfile> {
onSaved: (String? value) {
name = value!;
},
textInputAction: TextInputAction.next,
);
}

Expand All @@ -202,6 +204,7 @@ class _UploadProfile extends State<UploadProfile> {
onSaved: (String? value) {
rollNo = value!;
},
textInputAction: TextInputAction.next,
);
}

Expand Down Expand Up @@ -229,6 +232,7 @@ class _UploadProfile extends State<UploadProfile> {
onSaved: (String? value) {
regNo = value!;
},
textInputAction: TextInputAction.next,
);
}

Expand All @@ -245,6 +249,7 @@ class _UploadProfile extends State<UploadProfile> {
contentPadding: EdgeInsets.all(15.0),
filled: true,
),
keyboardType: TextInputType.emailAddress,
validator: (String? value) {
if (value!.isEmpty) {
return 'Email Required';
Expand All @@ -259,6 +264,7 @@ class _UploadProfile extends State<UploadProfile> {
onSaved: (String? value) {
email = value!;
},
textInputAction: TextInputAction.next,
);
}

Expand Down Expand Up @@ -377,8 +383,27 @@ class _UploadProfile extends State<UploadProfile> {
}

Widget buildDOBField() {
DateTime currentDateTime = DateTime.now(),
initialDateTime = currentDateTime.add(Duration(days: -(10 * 365))),
firstDateTime = currentDateTime.add(Duration(days: -(60 * 365))),
lastDateTime = currentDateTime.add(Duration(days: -(5 * 365)));
return TextFormField(
keyboardType: TextInputType.phone,
controller: dobController,
readOnly: true,
onTap: () {
showDatePicker(
context: context,
initialDate: initialDateTime,
firstDate: firstDateTime,
lastDate: lastDateTime,
).then((newDateTime) {
if (newDateTime != null) {
dobController.text = DateFormat('dd-MM-yyyy').format(newDateTime);
dob = DateFormat('dd-MM-yyyy').format(newDateTime);
}
});
},
decoration: const InputDecoration(
border: OutlineInputBorder(
borderRadius: BorderRadius.all(
Expand All @@ -392,13 +417,10 @@ class _UploadProfile extends State<UploadProfile> {
),
validator: (String? value) {
if (value!.isEmpty) {
return 'Address Required';
return 'Date of Birth Required';
}
return null;
},
onSaved: (String? value) {
dob = value.toString();
},
);
}

Expand Down
Loading

0 comments on commit 3ba8a1d

Please sign in to comment.