Skip to content

Commit

Permalink
Responsive to screensize
Browse files Browse the repository at this point in the history
  • Loading branch information
WaniAthar committed Mar 25, 2023
1 parent a62abe9 commit 8c47cfb
Show file tree
Hide file tree
Showing 8 changed files with 154 additions and 155 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import io.flutter.embedding.engine.FlutterEngine
import io.flutter.embedding.android.FlutterActivity

class MainActivity: FlutterActivity() {
override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
window.addFlags(LayoutParams.FLAG_SECURE)
super.configureFlutterEngine(flutterEngine)
}
// uncomment this to disable screenshot
//override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
//window.addFlags(LayoutParams.FLAG_SECURE)
//super.configureFlutterEngine(flutterEngine)
//}
}
Binary file modified assets/images/athar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 8 additions & 3 deletions lib/api/attendance_api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,14 @@ class API extends ChangeNotifier {
}
return name;
}
// add dummy data
// dummy api function to work on with
Future<void> getData(){
personalData = {"name":"John Doe", "usn":"01fe20bbb043"};
attendanceData =[{"cie_marks":"20/20","course_attendance":"55%","course_code":"20ECSk303","course_name":"Computer Networks-2","course_teacher":"John Doe"},{"cie_marks":"15/15","course_attendance":"93%","course_code":"20ECKC305","course_name":"Distributed & Cloud Computing","course_teacher":"Mark Henry"},{"cie_marks":"0/0","course_attendance":"0%","course_code":"16EHUC301","course_name":"PA & LR","course_teacher":"Albert Einstein"},{"cie_marks":"0/0","course_attendance":"75%","course_code":"20EOSP305","course_name":"Computer Networks Lab","course_teacher":"Newton"},{"cie_marks":"0/0","course_attendance":"0%","course_code":"15EPSW302","course_name":"Minor Project","course_teacher":"Tim Cook"},{"cie_marks":"0/0","course_attendance":"73%","course_code":"20ECSK307","course_name":"Blockchain and Distributed Ledgers","course_teacher":"Shimsuke Nakamura"},{"cie_marks":"20/20","course_attendance":"39%","course_code":"19ELSE303","course_name":"Semantic Web","course_teacher":"Tim Lee"},{"cie_marks":"0/0","course_attendance":"0%","course_code":"17PCSE307","course_name":"Parallel Computing","course_teacher":"Messi"},{"cie_marks":"0/0","course_attendance":"0%","course_code":"22EMSH302","course_name":"Industry Readiness and Leadership Skills","course_teacher":"Kabir singh"}]
isDataFetched = true;
notifyListeners();
// delay the data fetch by 2 seconds
Future.delayed(Duration(seconds: 2), () {
isDataFetched = true;
notifyListeners();
});
}
}
36 changes: 18 additions & 18 deletions lib/developer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import 'package:url_launcher/url_launcher.dart';

class AboutDev extends StatelessWidget {
const AboutDev({super.key});

@override
Widget build(BuildContext context) {
Size size = MediaQuery.of(context).size;
Expand Down Expand Up @@ -35,13 +34,16 @@ class AboutDev extends StatelessWidget {
height: double.infinity,
width: double.infinity,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
// image
Container(
margin: const EdgeInsets.only(top: 20),
width: size.width * 0.65,
child: const Image(
image: AssetImage("assets/images/athar.png"),
width: size.width * 0.6,
// cache image
child: Image(
image: const AssetImage("assets/images/athar.png"),
height: size.height * 0.3,
),
),
const Divider(
Expand All @@ -65,8 +67,8 @@ class AboutDev extends StatelessWidget {
indent: 100,
endIndent: 100,
),
const SizedBox(
height: 20,
SizedBox(
height: size.width * 0.05,
),
Container(
alignment: Alignment.center,
Expand All @@ -75,7 +77,7 @@ class AboutDev extends StatelessWidget {
"Hi, I'm Athar Mujtaba Wani, a developer who is interested in open source and language semantics.",
style: GoogleFonts.poppins(
color: Colors.white,
fontSize: 15,
fontSize: size.width * 0.03,
fontWeight: FontWeight.w500,
),
textAlign: TextAlign.center,
Expand All @@ -85,25 +87,22 @@ class AboutDev extends StatelessWidget {
"\"I make softwares that work\"",
style: GoogleFonts.poppins(
color: Colors.white,
fontSize: 15,
fontSize: size.width * 0.03,
fontWeight: FontWeight.bold),
),
const SizedBox(
height: 20,
SizedBox(
height: size.height * 0.04,
),
Text(
"Make a contribution",
style: GoogleFonts.poppins(
color: Colors.white,
fontSize: 15,
fontSize: size.width * 0.03,
),
),
SizedBox(
height: size.height * 0.01,
),

Container(
width: size.width * 0.2,
width: size.width * 0.13,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(50),
),
Expand All @@ -127,18 +126,19 @@ class AboutDev extends StatelessWidget {
},
child: const Image(
image: AssetImage("assets/images/github.png"),
height: 40,
),
),
),
SizedBox(
height: size.height * 0.07,
height: size.height * 0.1,
),
Text(
"Found a bug?",
style: GoogleFonts.poppins(color: Colors.white, fontSize: 12),
),
const SizedBox(
height: 10,
SizedBox(
height: size.height * 0.01,
),
Container(
decoration: BoxDecoration(
Expand Down
135 changes: 67 additions & 68 deletions lib/homepage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class HomePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
final api = Provider.of<API>(context, listen: false);
Size size = MediaQuery.of(context).size;
return Scaffold(
body: Container(
color: Colors.orange,
Expand All @@ -21,13 +22,13 @@ class HomePage extends StatelessWidget {
future: api.getData(),
builder: (BuildContext context, AsyncSnapshot<void> snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
return _buildShimmerEffect();
return _buildShimmerEffect(size);
} else if (snapshot.hasError) {
api.fetchErr = true;
return Column(
children: [
SizedBox(
height: 250,
height: size.height * 0.2,
width: double.infinity,
child: Lottie.asset(
"assets/lottieanimations/91950-loop-loading-animation.json"),
Expand All @@ -41,7 +42,7 @@ class HomePage extends StatelessWidget {
],
);
} else {
return _buildData(api);
return _buildData(api, size);
}
},
),
Expand All @@ -51,85 +52,83 @@ class HomePage extends StatelessWidget {

// ignore: non_constant_identifier_names

Widget _buildShimmerEffect() {
Widget _buildShimmerEffect(Size size) {
return Shimmer.fromColors(
baseColor: Colors.white30,
highlightColor: Colors.white,
child: Container(
height: size.height / 2 - 1,
margin: const EdgeInsets.only(bottom: 10),
child: Column(
children: [
Container(
alignment: Alignment.center,
margin: const EdgeInsets.all(5),
height: size.height * 0.2,
child: Lottie.asset(
"assets/lottieanimations/139432-person-riding-bicycle.json"),
),
Container(
margin: const EdgeInsets.symmetric(horizontal: 20, vertical: 10),
height: 25,
width: 200,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
color: Colors.grey[300],
),
),
Container(
margin: const EdgeInsets.symmetric(horizontal: 20, vertical: 10),
height: 20,
width: 150,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
color: Colors.grey[300],
),
),
],
),
),
);
}

Widget _buildData(API api, Size size) {
return Container(
height: size.height * 0.5 - 50,
margin: const EdgeInsets.only(bottom: 10),
child: Column(
children: [
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Container(
alignment: Alignment.center,
margin: const EdgeInsets.all(5),
height: 200,
height: size.height * 0.24,
child: Lottie.asset(
"assets/lottieanimations/139432-person-riding-bicycle.json"),
),
Container(
margin: const EdgeInsets.symmetric(horizontal: 20, vertical: 10),
height: 25,
width: 200,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
color: Colors.grey[300],
),
Text('${api.personalData['name']}',
style: GoogleFonts.poppins(
color: Colors.white,
fontSize: size.height * 0.026,
fontWeight: FontWeight.bold,
)),
const Divider(
color: Colors.white,
thickness: 1,
indent: 100,
endIndent: 100,
),
Container(
margin: const EdgeInsets.symmetric(horizontal: 20, vertical: 10),
height: 20,
width: 150,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
color: Colors.grey[300],
Text(
'${api.personalData['usn']}',
style: GoogleFonts.poppins(
color: Colors.white,
fontSize: size.height * 0.016,
fontWeight: FontWeight.w400,
letterSpacing: 2,
),
),
)
],
),
);
}

Widget _buildData(API api) {
return Column(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Container(
alignment: Alignment.center,
margin: const EdgeInsets.all(5),
height: 200,
child: Lottie.asset(
"assets/lottieanimations/139432-person-riding-bicycle.json"),
),
// TextLiquidFill(
// text: '${api.personalData['name']}',
// textStyle: GoogleFonts.poppins(
// color: Colors.white,
// fontSize: 25,
// fontWeight: FontWeight.bold,
// ),
// waveColor: Colors.white,
// boxBackgroundColor: Colors.orange,
// ),
Text('${api.personalData['name']}',
style: GoogleFonts.poppins(
color: Colors.white,
fontSize: 25,
fontWeight: FontWeight.bold,
)),
const Divider(
color: Colors.white,
thickness: 1,
indent: 100,
endIndent: 100,
),
Text(
'${api.personalData['usn']}',
style: GoogleFonts.poppins(
color: Colors.white,
fontSize: 15,
fontWeight: FontWeight.w400,
letterSpacing: 2,
),
)
],
);
}
}
9 changes: 5 additions & 4 deletions lib/input.dart
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ class _InputDataState extends State<InputData> {
child: ListView(children: [
Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const SizedBox(
height: 20,
Expand Down Expand Up @@ -129,7 +130,7 @@ class _InputDataState extends State<InputData> {
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
SizedBox(
width: deviceWidth * 0.27,
width: deviceWidth * 0.25,
child: TextField(
decoration: InputDecoration(
border: const OutlineInputBorder(
Expand Down Expand Up @@ -159,7 +160,7 @@ class _InputDataState extends State<InputData> {
},
),
),
SizedBox(width: deviceWidth * 0.01),
const SizedBox(width: 5),
SizedBox(
width: deviceWidth * 0.23,
child: TextField(
Expand Down Expand Up @@ -189,9 +190,9 @@ class _InputDataState extends State<InputData> {
},
),
),
SizedBox(width: deviceWidth * 0.01),
const SizedBox(width: 5),
SizedBox(
width: deviceWidth * 0.27,
width: deviceWidth * 0.25,
child: TextField(
decoration: InputDecoration(
border: const OutlineInputBorder(
Expand Down
Loading

0 comments on commit 8c47cfb

Please sign in to comment.