Skip to content

Commit

Permalink
Merge pull request harveyjavier#6 from harveyjavier/add-about-screen
Browse files Browse the repository at this point in the history
Add about screen
  • Loading branch information
harveyjavier authored Nov 3, 2019
2 parents ce40b3b + 57a5f44 commit 28f1a11
Show file tree
Hide file tree
Showing 10 changed files with 157 additions and 84 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Not yet available...

Running the project straight away will get you an error regarding a `key.properties` file that is missing. To fix it,

1. Open android/app/build.gradle file and comment the following lines-
1. Open `android/app/build.gradle` file and comment the following lines-

```
//keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
Expand All @@ -34,15 +34,15 @@ buildTypes {
}
```

2. Open android/local.properties file and add the following lines-
2. Open `android` folder, look for `local.properties` file (create if it does not exist), and add the following lines-

```
flutter.buildMode=debug
flutter.versionName=1.0.0
flutter.versionCode=1
```

3. Open the project on your cmd or terminal, type flutter run, then you're good to go!
3. And you're good to go. Open the project on your cmd or terminal, and type-

```
flutter run
Expand Down
Binary file added assets/images/bit-cover-image.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions lib/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import 'package:bicolit/screens/register_one.dart';
import 'package:bicolit/screens/register_two.dart';
import 'package:bicolit/screens/news_feed.dart';
import 'package:bicolit/screens/profile.dart';
import 'package:bicolit/screens/about.dart';
import 'package:bicolit/screens/edit_education.dart';
import 'package:bicolit/screens/edit_experience.dart';
import 'package:bicolit/screens/notfound_page.dart';
Expand Down Expand Up @@ -45,6 +46,7 @@ class App extends StatelessWidget {
UIData.registerTwoRoute: (BuildContext context) => RegisterTwo(),
UIData.newsFeedRoute: (BuildContext context) => NewsFeed(),
UIData.profileRoute: (BuildContext context) => Profile(),
UIData.aboutRoute: (BuildContext context) => About(),
UIData.editEducationRoute: (BuildContext context) => EditEducation(),
UIData.editExperienceRoute: (BuildContext context) => EditExperience(),
},
Expand Down
95 changes: 95 additions & 0 deletions lib/screens/about.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
import 'package:flutter/material.dart';

import 'package:bicolit/utils/uidata.dart';
import 'package:bicolit/tools/common_scaffold.dart';
import 'package:bicolit/tools/label_icon.dart';

class About extends StatefulWidget {
@override
State<StatefulWidget> createState() => _AboutState();
}

class _AboutState extends State<About> {
Size deviceSize;

@override
initState() {
super.initState();
}

Widget aboutHeader() => Container(
height: deviceSize.height / 4,
width: double.infinity,
color: Colors.black,
child: Padding(
padding: const EdgeInsets.all(10.0),
child: Card(
clipBehavior: Clip.antiAlias,
color: Colors.black,
child: FittedBox(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(50.0),
border: Border.all(width: 2.0, color: Colors.white),
image: DecorationImage(
image: AssetImage(UIData.bitCoverImage),
fit: BoxFit.cover,
),
),
child: InkWell(
onTap: () {},
child: CircleAvatar(
radius: 40.0,
backgroundImage: AssetImage(UIData.bitLogoImage),
),
)
),
SizedBox(height: 5.0),
Text("Bicol IT Org.", style: TextStyle(color: Colors.white, fontSize: 15.0)),
],
),
),
),
),
);

Widget aboutBody() => Padding(
padding: const EdgeInsets.all(8.0),
child: Card(
elevation: 2.0,
child: Column(
children: <Widget>[
Image.asset(UIData.bitCoverImage, fit: BoxFit.cover),
SizedBox(height: 3.0),
Padding(
padding: const EdgeInsets.all(8.0),
child: Text("Bicol Information Technology Organization (Bicol IT.org Inc) is a community of IT professionals, students, educators, and enthusiasts who are from or are in Bicol, Philippines. Its primary objective is to share expertise, conduct meetups, seminars, and workshops in the rest of the region. We conduct regular technology talks for free to augment the training needs and expose others to the latest trends in Information Technology."),
),
SizedBox(height: 5.0),
],
),
),
);

Widget bodyData() => SingleChildScrollView(
child: Column(
children: <Widget>[
aboutHeader(),
aboutBody(),
],
),
);

@override
Widget build(BuildContext context) {
deviceSize = MediaQuery.of(context).size;
return CommonScaffold(
appTitle: "About",
bodyData: bodyData(),
elevation: 0.0,
);
}
}
4 changes: 1 addition & 3 deletions lib/screens/login.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ class _LoginState extends State<Login> {
}

void onMount() {
if (storage.getItem("register_data") != null)
{ storage.clear(); }
if (storage.getItem("registered") != null) {
_scaffoldKey.currentState.showSnackBar(
SnackBar(
Expand Down Expand Up @@ -254,7 +252,7 @@ class _LoginState extends State<Login> {

if (_account_matched) {
storage.setItem("user_data", _user_data);
Navigator.pushNamed(context, UIData.newsFeedRoute);
Navigator.pushReplacement(context, MaterialPageRoute(builder: (BuildContext context) => NewsFeed()));
} else {
_scaffoldKey.currentState.showSnackBar(
SnackBar(
Expand Down
66 changes: 33 additions & 33 deletions lib/screens/profile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -103,39 +103,37 @@ class _ProfileState extends State<Profile> {
}

Future getImage() async {
if (!_uploading) {
var tempImage = await ImagePicker.pickImage(source: ImageSource.gallery);
setState(() { _image = tempImage; });
var tempImage = await ImagePicker.pickImage(source: ImageSource.gallery);
setState(() { _image = tempImage; });

return showDialog(
context: context,
barrierDismissible: false,
builder: (context) => WillPopScope(
onWillPop: () async => false,
child: AlertDialog(
title: Text("Confirm Upload", style: TextStyle(color: Colors.black),),
content: Image.file(tempImage),
// CircleAvatar(
// radius: 40.0,
// backgroundImage: FileImage(_image), //
// ),
actions: <Widget>[
FlatButton(
child: Text("Yes", style: TextStyle(color: Colors.black),),
onPressed: upload
),
FlatButton(
child: Text("Cancel", style: TextStyle(color: Colors.black),),
onPressed: () {
Navigator.pop(context, false);
setState(() { _image = null; });
},
),
],
),
return showDialog(
context: context,
barrierDismissible: false,
builder: (context) => WillPopScope(
onWillPop: () async => false,
child: AlertDialog(
title: Text("Confirm Upload", style: TextStyle(color: Colors.black),),
content: Image.file(tempImage),
// CircleAvatar(
// radius: 40.0,
// backgroundImage: FileImage(_image), //
// ),
actions: <Widget>[
FlatButton(
child: Text("Yes", style: TextStyle(color: Colors.black),),
onPressed: upload
),
FlatButton(
child: Text("Cancel", style: TextStyle(color: Colors.black),),
onPressed: () {
Navigator.pop(context, false);
setState(() { _image = null; });
},
),
],
),
);
}
),
);
}

Widget profileHeader() => Container(
Expand All @@ -157,7 +155,7 @@ class _ProfileState extends State<Profile> {
border: Border.all(width: 2.0, color: Colors.white)),
child: _uploading
? InkWell(
onTap: getImage,
onTap: () {},
child: CircleAvatar(
radius: 40.0,
backgroundImage: storage.getItem("user_data")["profile_image"] == null
Expand All @@ -173,7 +171,9 @@ class _ProfileState extends State<Profile> {
onTap: getImage,
child: CircleAvatar(
radius: 40.0,
backgroundImage: NetworkImage(storage.getItem("user_data")["profile_image"] == null ? "https://cdn.pixabay.com/photo/2015/10/05/22/37/blank-profile-picture-973460_960_720.png" : storage.getItem("user_data")["profile_image"]),
backgroundImage: storage.getItem("user_data")["profile_image"] == null
? AssetImage(UIData.defaultProfileImage)
: NetworkImage(storage.getItem("user_data")["profile_image"]),
),
)
),
Expand Down
8 changes: 0 additions & 8 deletions lib/screens/register_one.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,6 @@ class _RegisterOneState extends State<RegisterOne> {
_password_c = new TextEditingController();
_confirm_password_c = new TextEditingController();
super.initState();
WidgetsBinding.instance.addPostFrameCallback((_) => onMount());
}

void onMount() {
_email_c.text = storage.getItem("register_data")["email"] != null ? storage.getItem("register_data")["email"] : "";
_mobile_number_c.text = storage.getItem("register_data")["mobile_number"] != null ? storage.getItem("register_data")["mobile_number"] : "";
_password_c.text = storage.getItem("register_data")["password"] != null ? storage.getItem("register_data")["password"] : "";
_confirm_password_c.text = storage.getItem("register_data")["password"] != null ? storage.getItem("register_data")["password"] : "";
}

Future<bool> _onBack() {
Expand Down
55 changes: 20 additions & 35 deletions lib/screens/register_two.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,6 @@ class _RegisterTwoState extends State<RegisterTwo> {
_lastname_c = new TextEditingController();
_birthday_c = new TextEditingController();
super.initState();
WidgetsBinding.instance.addPostFrameCallback((_) => onMount());
}

void onMount() {
_username_c.text = storage.getItem("register_data")["username"] != null ? storage.getItem("register_data")["username"] : "";
_firstname_c.text = storage.getItem("register_data")["firstname"] != null ? storage.getItem("register_data")["firstname"] : "";
_lastname_c.text = storage.getItem("register_data")["lastname"] != null ? storage.getItem("register_data")["lastname"] : "";
_birthday_c.text = storage.getItem("register_data")["birthday"] != null ? storage.getItem("register_data")["birthday"] : "";
}

@override
Expand Down Expand Up @@ -141,34 +133,31 @@ class _RegisterTwoState extends State<RegisterTwo> {
padding: EdgeInsets.symmetric(vertical: 0.0, horizontal: 30.0),
child: TextFormField(
controller: _birthday_c,
onTap: () {
DatePicker.showDatePicker(context,
locale: LocaleType.en,
currentTime: DateTime.now(),
maxTime: DateTime.now(),
showTitleActions: true,
theme: DatePickerTheme(
backgroundColor: Colors.black,
itemStyle: TextStyle( color: Colors.white, fontWeight: FontWeight.bold),
doneStyle: TextStyle(color: Colors.white, fontSize: 16),
cancelStyle: TextStyle(color: Colors.white, fontSize: 16),
),
onConfirm: (date) {
setState(() {
_birthday = formatDate(date, [yyyy, "-", mm, "-", dd]);
_birthday_c.text = formatDate(date, [yyyy, "-", mm, "-", dd]);
});
},
);
},
maxLines: 1,
readOnly: true,
decoration: InputDecoration(
hintText: "Enter your birthday",
labelText: "Birthday",
suffixIcon: TextFieldIconButton(
icon: Icons.calendar_today,
onPressed: () {
DatePicker.showDatePicker(context,
locale: LocaleType.en,
currentTime: DateTime.now(),
maxTime: DateTime.now(),
showTitleActions: true,
theme: DatePickerTheme(
backgroundColor: Colors.black,
itemStyle: TextStyle( color: Colors.white, fontWeight: FontWeight.bold),
doneStyle: TextStyle(color: Colors.white, fontSize: 16),
),
onChanged: (date) { print(formatDate(date, [yyyy, "-", mm, "-", dd])); },
onConfirm: (date) {
setState(() {
_birthday = formatDate(date, [yyyy, "-", mm, "-", dd]);
_birthday_c.text = formatDate(date, [yyyy, "-", mm, "-", dd]);
});
},
);
},
),
),
validator: (input) {
if (input.isEmpty)
Expand Down Expand Up @@ -266,10 +255,6 @@ class _RegisterTwoState extends State<RegisterTwo> {
)
);
}
setState(() {
_signing_up = false;
_username_matched = false;
});
}
}
}
3 changes: 1 addition & 2 deletions lib/tools/drawer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@ class _AppDrawerState extends State<AppDrawer> {
Icons.info,
color: Colors.black,
),
onTap: () {},
//onTap: () { widget.current_screen == "about" ? Navigator.pop(context) : Navigator.pushNamed(context, UIData.aboutRoute); },
onTap: () { widget.current_screen == "about" ? Navigator.pop(context) : Navigator.pushNamed(context, UIData.aboutRoute); },
),
Divider( color: Colors.grey.shade300, height: 8.0, ),
ListTile(
Expand Down
2 changes: 2 additions & 0 deletions lib/utils/uidata.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class UIData {
static const String registerTwoRoute = "/registerTwo";
static const String newsFeedRoute = "/newsFeed";
static const String profileRoute = "/profile";
static const String aboutRoute = "/about";
static const String editEducationRoute = "/editEducation";
static const String editExperienceRoute = "/editExperience";
static const String notFoundRoute = "/notFound";
Expand All @@ -28,6 +29,7 @@ class UIData {
static const String imageDir = "assets/images";
static const String bitLogoImage = "$imageDir/bit-logo.png";
static const String bitLogoTransparentImage = "$imageDir/bit-logo-transparent.png";
static const String bitCoverImage = "$imageDir/bit-cover-image.jpg";
static const String defaultProfileImage = "$imageDir/default-profile-image.png";

//gneric
Expand Down

0 comments on commit 28f1a11

Please sign in to comment.