Skip to content

Commit

Permalink
fixed screen size issue and some minor bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
WaniAthar committed Mar 26, 2023
1 parent 8c47cfb commit 62c7b56
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 73 deletions.
7 changes: 2 additions & 5 deletions lib/developer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,8 @@ class AboutDev extends StatelessWidget {
Size size = MediaQuery.of(context).size;
return Scaffold(
appBar: AppBar(
backgroundColor: Colors.orange,
elevation: 0,
title: Text(
title: const Text(
"About Developer",
style: GoogleFonts.poppins(
color: Colors.white, fontWeight: FontWeight.bold),
),
leading: IconButton(
tooltip: "Back",
Expand Down Expand Up @@ -102,6 +98,7 @@ class AboutDev extends StatelessWidget {
),

Container(
margin: const EdgeInsets.only(top: 10),
width: size.width * 0.13,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(50),
Expand Down
78 changes: 45 additions & 33 deletions lib/homepage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,39 +13,51 @@ class HomePage extends StatelessWidget {
final api = Provider.of<API>(context, listen: false);
Size size = MediaQuery.of(context).size;
return Scaffold(
body: Container(
color: Colors.orange,
child: FutureBuilder(
// dont call the api.getData() here, it will call the api everytime the build method is called
// instead call it in the init state of the provider
// future: api.getPersonalData(),
future: api.getData(),
builder: (BuildContext context, AsyncSnapshot<void> snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
return _buildShimmerEffect(size);
} else if (snapshot.hasError) {
api.fetchErr = true;
return Column(
children: [
SizedBox(
height: size.height * 0.2,
width: double.infinity,
child: Lottie.asset(
"assets/lottieanimations/91950-loop-loading-animation.json"),
),
Text("Internet error :(",
style: GoogleFonts.poppins(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 20,
)),
],
);
} else {
return _buildData(api, size);
}
},
),
body: Stack(
children: [
Container(
color: Colors.orange,
child: FutureBuilder(
// dont call the api.getData() here, it will call the api everytime the build method is called
// instead call it in the init state of the provider
// future: api.getPersonalData(),
future: api.getData(),
builder: (BuildContext context, AsyncSnapshot<void> snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
return _buildShimmerEffect(size);
} else if (snapshot.hasError) {
api.fetchErr = true;
return Column(
children: [
SizedBox(
height: size.height * 0.2,
width: double.infinity,
child: Lottie.asset(
"assets/lottieanimations/91950-loop-loading-animation.json"),
),
Text("Internet error :(",
style: GoogleFonts.poppins(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 20,
)),
],
);
} else {
return _buildData(api, size);
}
},
),
),
Positioned(
top: size.height * 0.01,
right: size.width * 0.03,
child: Text(
"v1.1.2+5",
style: GoogleFonts.ubuntu(color: Colors.white, fontSize: 12),
),
)
],
),
);
}
Expand Down
14 changes: 2 additions & 12 deletions lib/input.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,10 @@ class _InputDataState extends State<InputData> {
double deviceWidth = MediaQuery.of(context).size.width;
double deviceHeight = MediaQuery.of(context).size.height;
return Scaffold(
resizeToAvoidBottomInset: false,
appBar: AppBar(
backgroundColor: Colors.orange,
iconTheme: const IconThemeData(
color: Colors.white,
),
elevation: 0,
centerTitle: true,
title: Text(
title: const Text(
"Login Details",
style: GoogleFonts.poppins(
color: Colors.white,
fontSize: 25,
fontWeight: FontWeight.w600,
),
),
actions: [
IconButton(
Expand Down
60 changes: 38 additions & 22 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// ignore_for_file: sort_child_properties_last, use_build_context_synchronously
import 'package:attendance/api/attendance_api.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:after_layout/after_layout.dart';
Expand All @@ -13,7 +14,12 @@ import 'package:lottie/lottie.dart';
import 'package:provider/provider.dart';

void main() {
runApp(const MyApp());
// set device orientation to portrait only
WidgetsFlutterBinding.ensureInitialized();
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp])
.then((_) {
runApp(const MyApp());
});
}

class MyApp extends StatefulWidget {
Expand All @@ -30,9 +36,25 @@ class _MyAppState extends State<MyApp> {
create: (context) => API(),
child: MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Attendance',
title: 'Attendd',
theme: ThemeData(
useMaterial3: true,
appBarTheme: AppBarTheme(
iconTheme: const IconThemeData(color: Colors.white),
systemOverlayStyle: const SystemUiOverlayStyle(
statusBarColor: Colors.transparent,
statusBarIconBrightness: Brightness.light),
backgroundColor: Colors.orange,
scrolledUnderElevation: 0,
elevation: 0,
centerTitle: true,
titleTextStyle: GoogleFonts.poppins(
color: Colors.white,
fontWeight: FontWeight.w600,
fontSize: 25,
),
),
primarySwatch: Colors.orange,
iconTheme: const IconThemeData(
color: Colors.white,
),
Expand Down Expand Up @@ -115,7 +137,7 @@ class TileContainer extends StatelessWidget {

@override
Widget build(BuildContext context) {
// calling checkAttendance fucntion to change colour of the container as per attendance
Size size = MediaQuery.of(context).size;
checkAttendance(attendance);
return Container(
child: Column(
Expand Down Expand Up @@ -162,18 +184,20 @@ class TileContainer extends StatelessWidget {
textBaseline: TextBaseline.alphabetic,
crossAxisAlignment: CrossAxisAlignment.baseline,
children: [
Container(
margin: const EdgeInsets.only(right: 10),
child: Text(
attendance,
textAlign: TextAlign.end,
style: GoogleFonts.poppins(
fontSize: 58,
fontWeight: FontWeight.bold,
color: Colors.white,
Flex(direction: Axis.horizontal, children: [
Container(
padding: const EdgeInsets.only(right: 20),
child: Text(
attendance,
textAlign: TextAlign.end,
style: GoogleFonts.poppins(
fontSize: size.width * 0.12,
fontWeight: FontWeight.bold,
color: Colors.white,
),
),
),
),
]),
],
),
],
Expand Down Expand Up @@ -233,16 +257,8 @@ class _SLiderState extends State<SLider> {
double deviceHeight = MediaQuery.of(context).size.height;
return Scaffold(
appBar: AppBar(
elevation: 0,
centerTitle: true,
backgroundColor: Colors.orange,
title: Text(
title: const Text(
"Attendd",
style: GoogleFonts.poppins(
color: Colors.white,
fontSize: 25,
fontWeight: FontWeight.w600,
),
),
leading: IconButton(
hoverColor: Colors.white,
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: An attendance app for KLE technological university students.
publish_to: 'none'


version: 1.1.1+4
version: 1.1.2+5

environment:
sdk: '>=2.18.6 <3.0.0'
Expand Down

0 comments on commit 62c7b56

Please sign in to comment.