Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Syllabus page UI changed #16

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"[dart]": {

"editor.tabSize": 2,
"editor.insertSpaces": true,
"editor.detectIndentation": false,
"editor.suggest.insertMode": "replace"
}
}
67 changes: 67 additions & 0 deletions assets/syllabus.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{
"syllabus": [
{
"stream": "Computer Science and Engineering",
"semester": [
["Physics", "English", "Maths"],
["Chemistry", "Engineering Drawing", "Programming"],
[
"Data Structures",
"Computer Organization",
"Analog and digital electronics"
]
]
},
{
"stream": "Electrical Engineering",
"semester": [
["Physics", "Electrical", "Maths"],
["Chemistry", "Engineering Drawing", "Programming"],
[
"Circuits",
"Computer Organization",
"Analog and digital electronics"
],
["Physics", "Electrical", "Maths"]
]
},
{
"stream": "Information Technology",
"semester": [
["Physics", "English", "Maths"],
["Chemistry", "Python", "Programming"],
[
"Data Structures",
"Computer Organization",
"Analog and digital electronics"
]
]
},
{
"stream": "Electronics and communicaton engineering",
"semester": [
["Physics", "English", "Maths"],
["Chemistry", "Engineering Drawing", "Programming"],
[
"Data Structures",
"Computer Organization",
"Analog and digital electronics",
"Maths",
"Physics"
]
]
},
{
"stream": "Civil engineering",
"semester": [
["Physics", "English", "Maths"],
["Chemistry", "Engineering Drawing", "Programming"],
[
"Data Structures",
"Computer Organization",
"Analog and digital electronics"
]
]
}
]
}
75 changes: 75 additions & 0 deletions lib/loginPage.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
import 'package:flutter/material.dart';

class LoginPage extends StatefulWidget {
@override
_LoginPageState createState() => _LoginPageState();
}

class _LoginPageState extends State<LoginPage> {
final _formkey = GlobalKey<FormState>();
final TextEditingController _emailController = TextEditingController();
final TextEditingController _passwordController = TextEditingController();
String _email, _password;

@override
Widget build(BuildContext context) {
return SafeArea(
child: Scaffold(
backgroundColor: Color(0xFFFBFCFC),
body: SingleChildScrollView(
child: Column(
children: <Widget>[
Center(
child: Container(
height: MediaQuery.of(context).size.height * 0.45,
width: MediaQuery.of(context).size.width * 0.8,
child: Image.asset('images/coverlight.png'),
),
),
Container(
child: Form(
key: _formkey,
child: Column(
children: <Widget>[
TextFormField(
controller: _emailController,
keyboardType: TextInputType.emailAddress,
validator: (input) {
if (input.isEmpty) return "Enter email";
},
decoration: InputDecoration(
hintText: "Enter email",
labelText: "Username",
prefixIcon: Icon(Icons.email),
),
onSaved: (input) => _email = input,
),
TextFormField(
controller: _passwordController,
keyboardType: TextInputType.text,
validator: (input) {
if (input.length < 6)
return "Password should be minimum 6 characters";
},
obscureText: true,
decoration: InputDecoration(
hintText: "Enter password",
labelText: "Password",
prefixIcon: Icon(Icons.lock)),
onSaved: (input) => _password = input,
),
RaisedButton(
onPressed: () {},
child: Text("Login"),
)
],
),
),
)
],
),
),
),
);
}
}
1 change: 1 addition & 0 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:slider_button/slider_button.dart';
import './appInfo.dart';
import './home_page.dart';
import 'loginPage.dart';

void main() {
runApp(MyApp());
Expand Down
175 changes: 72 additions & 103 deletions lib/syllabusPage.dart
Original file line number Diff line number Diff line change
@@ -1,127 +1,96 @@
import 'package:flutter/material.dart';
import 'package:timeline_tile/timeline_tile.dart';
import 'home_page.dart';
import 'dart:convert';
import 'package:flutter/services.dart' show rootBundle;
import 'package:timelines/timelines.dart';

Future<String> _loadSyllabusAsset() async {
return await rootBundle.loadString('assets/syllabus.json');
}

Future<Map<String, dynamic>> loadSyllabus() async {
String data = await _loadSyllabusAsset();
final jsonSyllabus = jsonDecode(data) as Map<String, dynamic>;
return jsonSyllabus;
}

class SyllabusPage extends StatefulWidget {
@override
_SyllabusPageState createState() => _SyllabusPageState();
}

class _SyllabusPageState extends State<SyllabusPage> {
@override
Widget build(BuildContext context) {
double screenSize = MediaQuery.of(context).size.height;

return Scaffold(
backgroundColor: Color(0xfffbfcfc),
body: ListView(
children: <Widget>[
Padding(
padding: EdgeInsets.all(10.0),
child: Column(
children: <Widget>[
HorizontalCard('Computer is bad for computers', 'profName',
'Openbook_.png'),
HorizontalCard('Computer is bad for computers', 'profName',
'Openbook_.png'),
],
),
),
],
),
);
}
}

class HorizontalCard extends StatelessWidget {
final String subjName;
final String profName;
final String imgpPath;

const HorizontalCard(
this.subjName,
this.profName,
this.imgpPath,
);
Map<String, dynamic> jsonSyllabus;
int stream = 3, sem = 2;

@override
Widget build(BuildContext context) {
double screenSize = MediaQuery.of(context).size.height;
return Padding(
padding: EdgeInsets.symmetric(vertical: 15.0),
child: Container(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Flexible(
child: Padding(
padding: EdgeInsets.all(15.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Flexible(
child: Container(
child: Text(
subjName,
style: TextStyle(
fontSize: screenSize > 700 ? 22.0 : 20,
fontFamily: 'RobotoMono',
fontWeight: FontWeight.bold),
),
),
return FutureBuilder<Map<String, dynamic>>(
future: loadSyllabus(),
builder: (context, snapshot) {
if (snapshot.hasData) {
jsonSyllabus = snapshot.data;
return Scaffold(
backgroundColor: Color(0xff16697a),
body: Padding(
padding: EdgeInsets.only(top: 40.0),
child: Timeline.tileBuilder(
theme: TimelineThemeData(
nodePosition: 0.1,
indicatorTheme: IndicatorThemeData(
position: 0,
size: 25,
color: Color(0xfffcca46),
),
connectorTheme: ConnectorThemeData(
thickness: 5,
color: Color(0xfffcca46),
indent: 4.0,
),
),
builder: TimelineTileBuilder.fromStyle(
contentsBuilder: (context, index) => Padding(
padding: EdgeInsets.only(
top: 10.0,
left: 10.0,
right: 10.0,
bottom: 50.0,
),
Flexible(
child: Container(
child: Text(
"By Prof. $profName",
style: TextStyle(
fontSize: screenSize > 700 ? 15.0 : 13,
child: Container(
child: Card(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(6.0),
),
elevation: 6.0,
shadowColor: Colors.white,
color: Colors.white,
child: Padding(
padding: const EdgeInsets.all(10.0),
child: Text(
jsonSyllabus['syllabus'][stream]['semester'][sem]
[index],
style: TextStyle(
fontSize: 16.0,
fontFamily: 'RobotoMono',
fontWeight: FontWeight.w700),
fontWeight: FontWeight.bold,
),
),
),
),
),
],
),
),
),
Container(
height: screenSize > 700
? MediaQuery.of(context).size.height * 0.2
: MediaQuery.of(context).size.height * 0.22,
width: MediaQuery.of(context).size.width * 0.35,
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
topRight: Radius.circular(30.0),
bottomRight: Radius.circular(30.0),
),
itemCount:
jsonSyllabus['syllabus'][stream]['semester'][sem].length,
),
//color: Colors.red,
image: DecorationImage(
image: AssetImage('images/$imgpPath'), fit: BoxFit.cover),
),
)
],
),
height: screenSize > 700
? MediaQuery.of(context).size.height * 0.2
: MediaQuery.of(context).size.height * 0.22,
width: MediaQuery.of(context).size.width * 0.9,
decoration: BoxDecoration(
color: Color(0xfffbfcfc),
//color: Colors.grey[200],
borderRadius: BorderRadius.all(
Radius.circular(30.0),
),
boxShadow: [
new BoxShadow(
offset: Offset(0, 15),
color: Color(0xff666666).withOpacity(.11),
blurRadius: 30.0,
),
],
),
),
);
} else if (snapshot.hasError) {
return Text("${snapshot.error}");
}
return CircularProgressIndicator();
},
);
}
}
Loading