Skip to content

Commit

Permalink
Merge pull request #2 from shuence/Screen-Responsive-and-BottomBar
Browse files Browse the repository at this point in the history
Made responsive across devices
  • Loading branch information
shuence authored Apr 28, 2024
2 parents 2bfdee0 + 930b58c commit 9204727
Show file tree
Hide file tree
Showing 37 changed files with 456 additions and 377 deletions.
34 changes: 25 additions & 9 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:spoonshare/firebase_options.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:spoonshare/splash_screen.dart';
import 'package:device_preview/device_preview.dart';

void main() async {
WidgetsFlutterBinding.ensureInitialized();
Expand All @@ -11,22 +14,35 @@ void main() async {
);
await SharedPreferences.getInstance();

runApp(const MyApp());
runApp(
DevicePreview(
enabled: !kReleaseMode,
builder: (context) => const MyApp(),
),
);
}

class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);

@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Spoon Share',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: const SplashScreen(),
debugShowCheckedModeBanner: false,
return ScreenUtilInit(
designSize: const Size(360, 700),
minTextAdapt: true,
splitScreenMode: true,
builder: (_, child) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Spoon Share',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.orange),
useMaterial3: true,
),
home: child,
);
},
child: const SplashScreen(),
);
}
}
28 changes: 11 additions & 17 deletions lib/onboarding.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:spoonshare/screens/auth/signin.dart';
import 'package:spoonshare/screens/auth/signup.dart';

Expand All @@ -8,22 +9,20 @@ class Onboarding extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
body: SingleChildScrollView(
child: Center(
child: Container(
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height,
padding: EdgeInsets.only(
top: MediaQuery.of(context).padding.top,
),
color: Colors.white,
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Container(
width: MediaQuery.of(context).size.width,
height: 146,
height: 146.h,
decoration: const BoxDecoration(color: Color(0xFFFF9F1C)),
child: Column(
child: const Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
Expand All @@ -50,21 +49,16 @@ class Onboarding extends StatelessWidget {
),
),
Container(
width: 310,
height: 290,
padding: const EdgeInsets.only(
left: 32,
right: 32,
top: 42,
),
width: 310.w,
height: 220.h,
decoration: const BoxDecoration(
image: DecorationImage(
image: AssetImage("assets/images/onboarding.png"),
fit: BoxFit.fill,
),
),
),
const SizedBox(height: 16),
const SizedBox(height: 14),
const Text(
'Be the Spoon in someone\'s road,',
textAlign: TextAlign.center,
Expand All @@ -85,7 +79,7 @@ class Onboarding extends StatelessWidget {
fontWeight: FontWeight.w500,
),
),
const SizedBox(height: 50),
const SizedBox(height: 10),
ElevatedButton(
onPressed: () {
Navigator.of(context).pushReplacement(MaterialPageRoute(
Expand Down Expand Up @@ -149,10 +143,9 @@ class Onboarding extends StatelessWidget {
),
],
),
const SizedBox(height: 50),
Container(
margin:
const EdgeInsets.only(top: 10), // Add margin to the top
const EdgeInsets.only(top: 10),
child: SizedBox(
width: 296,
child: Text.rich(
Expand Down Expand Up @@ -211,6 +204,7 @@ class Onboarding extends StatelessWidget {
),
),
),
),
);
}
}
3 changes: 1 addition & 2 deletions lib/screens/admin/admin_home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import 'package:spoonshare/screens/admin/verify_donated_food.dart';
import 'package:spoonshare/screens/admin/verify_recycle_food.dart';
import 'package:spoonshare/screens/admin/verify_shared_food.dart';
import 'package:spoonshare/screens/profile/user_profile.dart';
import 'package:spoonshare/widgets/bottom_navbar.dart';
import 'package:spoonshare/widgets/snackbar.dart';

class AdminHomeScreen extends StatefulWidget {
Expand Down Expand Up @@ -55,7 +54,7 @@ class _AdminHomeScreenState extends State<AdminHomeScreen> {
Widget build(BuildContext context) {
return Scaffold(
body: _buildVerifiedContent(),
bottomNavigationBar: const BottomNavBar(),

);
}

Expand Down
22 changes: 19 additions & 3 deletions lib/screens/admin/all_ngos.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import 'package:flutter/material.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:spoonshare/screens/admin/ngo_management.dart';
import 'package:spoonshare/widgets/bottom_navbar.dart';
import 'package:spoonshare/widgets/snackbar.dart';

class AllNGOScreen extends StatefulWidget {
Expand Down Expand Up @@ -109,7 +108,7 @@ class _AllNGOScreenState extends State<AllNGOScreen> {
);
},
),
bottomNavigationBar: const BottomNavBar(),

);
}
}
Expand Down Expand Up @@ -234,13 +233,30 @@ class ngoDetailsPage extends StatelessWidget {
style: const TextStyle(fontSize: 16),
),
),
const SizedBox(height: 10),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: Colors.red,
foregroundColor: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(50),
),
),
onPressed: () => _deletengo(ngoDoc, context),
child: const Text('Remove NGO'),
),
],
),
],
),
),
],
),
),
bottomNavigationBar: const BottomNavBar(),

);
}
}
Expand Down
3 changes: 1 addition & 2 deletions lib/screens/admin/ngo_management.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import 'package:flutter/material.dart';
import 'package:spoonshare/screens/admin/all_ngos.dart';
import 'package:spoonshare/screens/admin/verify_ngo.dart';
import 'package:spoonshare/screens/ngo/ngo_form.dart';
import 'package:spoonshare/widgets/bottom_navbar.dart';

class NGOManageScreen extends StatelessWidget {
const NGOManageScreen({Key? key});
Expand Down Expand Up @@ -43,7 +42,7 @@ class NGOManageScreen extends StatelessWidget {
),
),
),
bottomNavigationBar: const BottomNavBar(),

);
}

Expand Down
5 changes: 2 additions & 3 deletions lib/screens/admin/verify_donated_food.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import 'package:flutter/material.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:geolocator/geolocator.dart';
import 'package:intl/intl.dart';
import 'package:spoonshare/widgets/bottom_navbar.dart';
import 'package:spoonshare/widgets/snackbar.dart';

class VerifyDonatedFood extends StatefulWidget {
Expand Down Expand Up @@ -157,7 +156,7 @@ class _VerifyDonatedFoodState extends State<VerifyDonatedFood> {
);
},
),
bottomNavigationBar: const BottomNavBar(),

);
}
}
Expand Down Expand Up @@ -355,7 +354,7 @@ class FoodDetailsPage extends StatelessWidget {
],
),
),
bottomNavigationBar: const BottomNavBar(),

);
}
}
Expand Down
5 changes: 2 additions & 3 deletions lib/screens/admin/verify_ngo.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import 'package:flutter/material.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:spoonshare/screens/admin/ngo_management.dart';
import 'package:spoonshare/widgets/bottom_navbar.dart';
import 'package:spoonshare/widgets/snackbar.dart';

class verifyNGO extends StatefulWidget {
Expand Down Expand Up @@ -109,7 +108,7 @@ class _verifyNGOState extends State<verifyNGO> {
);
},
),
bottomNavigationBar: const BottomNavBar(),

);
}
}
Expand Down Expand Up @@ -268,7 +267,7 @@ class ngoDetailsPage extends StatelessWidget {
],
),
),
bottomNavigationBar: const BottomNavBar(),

);
}
}
Expand Down
5 changes: 2 additions & 3 deletions lib/screens/admin/verify_recycle_food.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import 'package:flutter/material.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:geolocator/geolocator.dart';
import 'package:intl/intl.dart';
import 'package:spoonshare/widgets/bottom_navbar.dart';
import 'package:spoonshare/widgets/snackbar.dart';

class VerifyRecycleFood extends StatefulWidget {
Expand Down Expand Up @@ -168,7 +167,7 @@ class _VerifyRecycleFoodState extends State<VerifyRecycleFood> {
);
},
),
bottomNavigationBar: const BottomNavBar(),

);
}
}
Expand Down Expand Up @@ -366,7 +365,7 @@ class FoodDetailsPage extends StatelessWidget {
],
),
),
bottomNavigationBar: const BottomNavBar(),

);
}
}
Expand Down
5 changes: 2 additions & 3 deletions lib/screens/admin/verify_shared_food.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import 'package:flutter/material.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:geolocator/geolocator.dart';
import 'package:intl/intl.dart';
import 'package:spoonshare/widgets/bottom_navbar.dart';
import 'package:spoonshare/widgets/snackbar.dart';

class VerifySharedFood extends StatefulWidget {
Expand Down Expand Up @@ -155,7 +154,7 @@ class _VerifySharedFoodState extends State<VerifySharedFood> {
);
},
),
bottomNavigationBar: const BottomNavBar(),

);
}
}
Expand Down Expand Up @@ -360,7 +359,7 @@ class FoodDetailsPage extends StatelessWidget {
],
),
),
bottomNavigationBar: const BottomNavBar(),

);
}
}
Expand Down
5 changes: 1 addition & 4 deletions lib/screens/auth/signin.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@ class _SignInScreenState extends State<SignInScreen> {
child: Container(
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height,
padding: EdgeInsets.only(
top: MediaQuery.of(context).padding.top,
),
clipBehavior: Clip.antiAlias,
decoration: const BoxDecoration(color: Colors.white),
child: Column(
Expand Down Expand Up @@ -361,7 +358,7 @@ class _SignInScreenState extends State<SignInScreen> {
),
),
),
const SizedBox(height: 32),
const SizedBox(height: 20),
ElevatedButton(
onPressed: () async {
// Show loading indicator
Expand Down
Loading

0 comments on commit 9204727

Please sign in to comment.