Skip to content

Commit

Permalink
Merge pull request #165 from krishitapandey/main
Browse files Browse the repository at this point in the history
Adding screen utili package #106 enhancement level3
  • Loading branch information
yagnik2411 authored May 29, 2024
2 parents df1d1ac + ef66b28 commit f52dc86
Show file tree
Hide file tree
Showing 15 changed files with 358 additions and 331 deletions.
Binary file modified .gradle/8.1.1/checksums/checksums.lock
Binary file not shown.
Binary file modified .gradle/8.1.1/checksums/md5-checksums.bin
Binary file not shown.
Binary file modified .gradle/8.1.1/checksums/sha1-checksums.bin
Binary file not shown.
28 changes: 19 additions & 9 deletions lib/about.dart
Original file line number Diff line number Diff line change
@@ -1,39 +1,49 @@
import 'package:flutter/material.dart';
import 'package:url_launcher/link.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

class AboutScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
ScreenUtil.init(
context,
);
return Scaffold(
appBar: AppBar(
title: Text('About App'),
),
body: Padding(
padding: const EdgeInsets.fromLTRB(50, 0, 40, 70),
padding: EdgeInsets.fromLTRB(
ScreenUtil().setWidth(50),
ScreenUtil().setWidth(0),
ScreenUtil().setWidth(40),
ScreenUtil().setWidth(70),
),
// const EdgeInsets.fromLTRB(50, 0, 40, 70),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
// Image
Image.asset(
'assets/logo.png',
width: 300,
height: 300,
width: ScreenUtil().setWidth(250),
height: ScreenUtil().setHeight(250),
fit: BoxFit.contain,
),
SizedBox(height: 5),
SizedBox(height: ScreenUtil().setHeight(05)),
// Version
Text(
'Version 1.0.0',
style: TextStyle(fontSize: 18),
style: TextStyle(fontSize: ScreenUtil().setSp(16)),
),
SizedBox(height: 10),
SizedBox(height: ScreenUtil().setHeight(10)),
// App Description
Text(
'OpSo',
textAlign: TextAlign.center,
style: TextStyle(fontSize: 16),
style: TextStyle(fontSize: ScreenUtil().setSp(16)),
),
SizedBox(height: 20),
SizedBox(height: ScreenUtil().setHeight(20)),
// GitHub Button
Link(
uri: Uri.parse('https://github.com/andoriyaprashant/OpSo'),
Expand All @@ -44,7 +54,7 @@ class AboutScreen extends StatelessWidget {
label: Text('GitHub'),
),
),
SizedBox(height: 10),
SizedBox(height: ScreenUtil().setHeight(10)),

// Link(
// uri: Uri.parse('https://gssoc.girlscript.tech/'),
Expand Down
66 changes: 35 additions & 31 deletions lib/bar.dart
Original file line number Diff line number Diff line change
@@ -1,52 +1,58 @@
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:opso/about.dart';
import 'package:url_launcher/link.dart';
import 'package:opso/widgets/book_mark_screen.dart';

class AppBarWidget extends StatelessWidget implements PreferredSizeWidget {
const AppBarWidget({Key? key}) : super(key: key);

@override
Widget build(BuildContext context) {
ScreenUtil.init(
context,
designSize: const Size(360, 690),
);

return Scaffold(
appBar: AppBar(
title: const Text(
title: Text(
'OpSo',
style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
style: TextStyle(
fontSize: ScreenUtil().setSp(20), fontWeight: FontWeight.bold),
),
actions: [
IconButton(
icon: const Icon(Icons.search),
onPressed: () {
showSearch(context: context, delegate: CustomSearchDelegate());
},
),
],
},
),
],
),
body: Material(
color: Colors.transparent,
child: Ink(
decoration: const BoxDecoration(
decoration: BoxDecoration(
color: Colors.white,
),
child: InkWell(
child: Padding(
padding: const EdgeInsets.all(16.0),
padding: EdgeInsets.all(ScreenUtil().setWidth(16)),
child: ListView(
children: [

MenuOption(
title: 'Bookmarks',
onTap: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => const BookMarkScreen()),
MaterialPageRoute(
builder: (context) => const BookMarkScreen()),
);
},
),

const Padding(padding: EdgeInsets.only(top: 40)),

Padding(
padding:
EdgeInsets.only(top: ScreenUtil().setHeight(40))),
MenuOption(
title: 'About',
onTap: () {
Expand All @@ -56,18 +62,17 @@ class AppBarWidget extends StatelessWidget implements PreferredSizeWidget {
);
},
),

],
),
),
),
),
),
),
)
);
}

@override
Size get preferredSize => const Size.fromHeight(kToolbarHeight);
Size get preferredSize => Size.fromHeight(kToolbarHeight);
}

class MenuOption extends StatefulWidget {
Expand Down Expand Up @@ -100,10 +105,10 @@ class _MenuOptionState extends State<MenuOption> {
child: Ink(
decoration: BoxDecoration(
color: const Color.fromARGB(255, 237, 237, 239),
borderRadius: BorderRadius.circular(25),
borderRadius: BorderRadius.circular(ScreenUtil().setWidth(25)),
),
child: InkWell(
borderRadius: BorderRadius.circular(20),
borderRadius: BorderRadius.circular(ScreenUtil().setWidth(20)),
onTap: () {
setState(() {
_isClicked = !_isClicked;
Expand All @@ -112,29 +117,28 @@ class _MenuOptionState extends State<MenuOption> {
},
child: Container(
child: Padding(
padding: const EdgeInsets.all(10.0),
padding: EdgeInsets.all(ScreenUtil().setWidth(10)),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Padding(
padding: const EdgeInsets.all(10.0),
padding: EdgeInsets.all(ScreenUtil().setWidth(10)),
child: Text(
widget.title,
style: const TextStyle(
fontSize: 18,
style: TextStyle(
fontSize: ScreenUtil().setSp(18),
fontWeight: FontWeight.bold,
),
),
),

const Icon(Icons.arrow_forward_ios),
],
),
),
),
),
),
),
)
);
}
}
Expand All @@ -145,12 +149,12 @@ class CustomSearchDelegate extends SearchDelegate {
return [
query.isNotEmpty
? IconButton(
icon: const Icon(Icons.clear),
onPressed: () {
query = '';
showSuggestions(context);
},
)
icon: const Icon(Icons.clear),
onPressed: () {
query = '';
showSuggestions(context);
},
)
: Container(),
];
}
Expand Down
54 changes: 33 additions & 21 deletions lib/home_page.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'dart:ui';
import 'package:flutter_screenutil/flutter_screenutil.dart';

import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
Expand Down Expand Up @@ -96,15 +97,23 @@ class _HomePageState extends State<HomePage> {

@override
Widget build(BuildContext context) {
var media = MediaQuery.of(context).size;
// var media = MediaQuery.of(context).size;
Color backgroundColor = Theme.of(context).brightness == Brightness.dark
? Colors.black.withOpacity(0.6) // Example dark mode color
: Colors.white.withOpacity(0.6); // Example light mode color

ScreenUtil.init(
context,
);
final double appBarFontSize = ScreenUtil().setSp(18);
final double appTextFontSize = ScreenUtil().setSp(20);
final double SizedSize = ScreenUtil().setHeight(20);
return Scaffold(
appBar: AppBar(
title: const Text(
title: Text(
'OpSo',
style: TextStyle(fontWeight: FontWeight.bold),
style:
TextStyle(fontWeight: FontWeight.bold, fontSize: appBarFontSize),
),
actions: [
IconButton(
Expand Down Expand Up @@ -143,25 +152,27 @@ class _HomePageState extends State<HomePage> {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(
SizedBox(
height: kTextTabBarHeight,
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Icon(FontAwesomeIcons.bars),
SizedBox(width: 10),
SizedBox(
width: ScreenUtil().setWidth(100),
),
Text(
'Menu',
style: TextStyle(
fontSize: 20,
fontSize: appTextFontSize,
// color: Colors.black,
fontWeight: FontWeight.w700,
),
),
],
),
),
const SizedBox(height: 15),
SizedBox(height: ScreenUtil().setHeight(15)),
const Divider(
color: Colors.black26,
height: 1,
Expand All @@ -170,7 +181,7 @@ class _HomePageState extends State<HomePage> {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(height: 15),
SizedBox(height: ScreenUtil().setHeight(15)),
InkWell(
onTap: () {},
child: ListTile(
Expand Down Expand Up @@ -208,7 +219,7 @@ class _HomePageState extends State<HomePage> {
const SizedBox(height: 15),
ListTile(
leading: Transform.rotate(
angle: 90 * math.pi/180,
angle: 90 * math.pi / 180,
child: const Icon(
FontAwesomeIcons.timeline,
),
Expand All @@ -218,12 +229,13 @@ class _HomePageState extends State<HomePage> {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const OpsoTimeLineScreen(),
builder: (context) =>
const OpsoTimeLineScreen(),
),
);
},
),
const SizedBox(height: 15),
SizedBox(height: ScreenUtil().setHeight(15)),
ListTile(
leading:
const Icon(FontAwesomeIcons.circleInfo),
Expand All @@ -237,15 +249,15 @@ class _HomePageState extends State<HomePage> {
);
},
),
const SizedBox(height: 15),
SizedBox(height: ScreenUtil().setHeight(15)),
],
),
),
const Divider(
color: Colors.black26,
height: 1,
),
const SizedBox(height: 15),
SizedBox(height: ScreenUtil().setHeight(15)),
],
),
),
Expand Down Expand Up @@ -354,10 +366,10 @@ class ProgramOption extends StatelessWidget {
GestureDetector(
onTap: onTap,
child: Container(
padding: const EdgeInsets.all(20),
padding: EdgeInsets.all(ScreenUtil().setWidth(20)),
decoration: BoxDecoration(
// color: const Color.fromARGB(255, 237, 237, 239),
borderRadius: BorderRadius.circular(15),
borderRadius: BorderRadius.circular(15),
border: Border.all(
width: 1,
color: borderColor,
Expand All @@ -367,15 +379,15 @@ class ProgramOption extends StatelessWidget {
children: [
Image.asset(
imageAssetPath,
width: 50,
height: 50,
width: ScreenUtil().setWidth(50),
height: ScreenUtil().setHeight(50),
),
const SizedBox(width: 20),
SizedBox(width: ScreenUtil().setWidth(20)),
Expanded(
child: Text(
title,
style: const TextStyle(
fontSize: 18,
style: TextStyle(
fontSize: ScreenUtil().setSp(18),
fontWeight: FontWeight.bold,
),
),
Expand All @@ -385,7 +397,7 @@ class ProgramOption extends StatelessWidget {
),
),
),
const SizedBox(height: 20), // Adding SizedBox between each button
SizedBox(height: ScreenUtil().setHeight(20)),
],
);
}
Expand Down
Loading

0 comments on commit f52dc86

Please sign in to comment.