Skip to content

Commit

Permalink
responsive added
Browse files Browse the repository at this point in the history
  • Loading branch information
stp2003 committed Feb 23, 2024
1 parent 22b2021 commit 9fded48
Show file tree
Hide file tree
Showing 10 changed files with 552 additions and 514 deletions.
534 changes: 272 additions & 262 deletions lib/core/common/post_card.dart

Large diffs are not rendered by default.

73 changes: 38 additions & 35 deletions lib/features/community/screens/create_community_screen.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:reddit/responsive/responsive.dart';

import '../../../core/common/loader.dart';
import '../controller/community_controller.dart';
Expand Down Expand Up @@ -37,47 +38,49 @@ class _CreateCommunityScreenState extends ConsumerState<CreateCommunityScreen> {
),
body: isLoading
? const Loader()
: Padding(
padding: const EdgeInsets.all(10.0),
child: Column(
children: [
const Align(
alignment: Alignment.topLeft,
child: Text(
'Community name',
style: TextStyle(
fontSize: 17.0,
: Responsive(
child: Padding(
padding: const EdgeInsets.all(10.0),
child: Column(
children: [
const Align(
alignment: Alignment.topLeft,
child: Text(
'Community name',
style: TextStyle(
fontSize: 17.0,
),
),
),
),
const SizedBox(height: 15.0),
TextField(
controller: communityNameController,
decoration: const InputDecoration(
hintText: 'r/Community_name',
filled: true,
border: InputBorder.none,
contentPadding: EdgeInsets.all(18),
),
maxLength: 21,
),
const SizedBox(height: 30),
ElevatedButton(
onPressed: createCommunity,
style: ElevatedButton.styleFrom(
minimumSize: const Size(double.infinity, 50),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20),
const SizedBox(height: 15.0),
TextField(
controller: communityNameController,
decoration: const InputDecoration(
hintText: 'r/Community_name',
filled: true,
border: InputBorder.none,
contentPadding: EdgeInsets.all(18),
),
maxLength: 21,
),
child: const Text(
'Create community',
style: TextStyle(
fontSize: 17,
const SizedBox(height: 30),
ElevatedButton(
onPressed: createCommunity,
style: ElevatedButton.styleFrom(
minimumSize: const Size(double.infinity, 50),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20),
),
),
child: const Text(
'Create community',
style: TextStyle(
fontSize: 17,
),
),
),
),
],
],
),
),
),
);
Expand Down
153 changes: 79 additions & 74 deletions lib/features/community/screens/edit_community_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:dotted_border/dotted_border.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:reddit/responsive/responsive.dart';
import 'package:reddit/theme/pallete.dart';

import '../../../core/common/error.dart';
Expand Down Expand Up @@ -109,86 +110,90 @@ class _EditCommunityScreenState extends ConsumerState<EditCommunityScreen> {
),
body: isLoading
? const Loader()
: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: [
SizedBox(
height: 200,
child: Stack(
children: [
GestureDetector(
onTap: selectBannerImage,
child: DottedBorder(
borderType: BorderType.RRect,
radius: const Radius.circular(10),
dashPattern: const [10, 4],
strokeCap: StrokeCap.round,
color:
currentTheme.textTheme.bodyMedium!.color!,
child: Container(
width: double.infinity,
height: 150,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
),
child: bannerWebFile != null
? Image.memory(
bannerWebFile!,
fit: BoxFit.cover,
)
: bannerFile != null
? Image.file(
bannerFile!,
fit: BoxFit.cover,
)
: community.banner.isEmpty ||
community.banner ==
Constants.bannerDefault
? const Center(
child: Icon(
Icons.camera_alt_outlined,
size: 40,
: Responsive(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: [
SizedBox(
height: 200,
child: Stack(
children: [
GestureDetector(
onTap: selectBannerImage,
child: DottedBorder(
borderType: BorderType.RRect,
radius: const Radius.circular(10),
dashPattern: const [10, 4],
strokeCap: StrokeCap.round,
color: currentTheme
.textTheme.bodyMedium!.color!,
child: Container(
width: double.infinity,
height: 150,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
),
child: bannerWebFile != null
? Image.memory(
bannerWebFile!,
fit: BoxFit.cover,
)
: bannerFile != null
? Image.file(
bannerFile!,
fit: BoxFit.cover,
)
: community.banner.isEmpty ||
community.banner ==
Constants
.bannerDefault
? const Center(
child: Icon(
Icons
.camera_alt_outlined,
size: 40,
),
)
: Image.network(
community.banner,
fit: BoxFit.cover,
),
)
: Image.network(
community.banner,
fit: BoxFit.cover,
),
),
),
),
),
Positioned(
bottom: 20,
left: 20,
child: GestureDetector(
onTap: selectProfileImage,
child: profileWebFile != null
? CircleAvatar(
backgroundImage: MemoryImage(
profileWebFile!,
),
radius: 32,
)
: profileFile != null
? CircleAvatar(
backgroundImage: FileImage(
profileFile!,
),
radius: 32,
)
: CircleAvatar(
backgroundImage: NetworkImage(
community.avatar,
),
radius: 32,
Positioned(
bottom: 20,
left: 20,
child: GestureDetector(
onTap: selectProfileImage,
child: profileWebFile != null
? CircleAvatar(
backgroundImage: MemoryImage(
profileWebFile!,
),
radius: 32,
)
: profileFile != null
? CircleAvatar(
backgroundImage: FileImage(
profileFile!,
),
radius: 32,
)
: CircleAvatar(
backgroundImage: NetworkImage(
community.avatar,
),
radius: 32,
),
),
),
),
],
],
),
),
),
],
],
),
),
),
),
Expand Down
5 changes: 4 additions & 1 deletion lib/features/home/screen/home_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import 'package:reddit/core/constants/constants.dart';
import 'package:reddit/features/auth/controller/auth_controller.dart';
import 'package:reddit/features/home/drawers/community_list_drawer.dart';
import 'package:reddit/features/home/drawers/profile_drawer.dart';
import 'package:routemaster/routemaster.dart';

import '../../../theme/pallete.dart';
import '../delegates/search_community_delegate.dart';
Expand Down Expand Up @@ -60,7 +61,9 @@ class _HomeScreenState extends ConsumerState<HomeScreen> {
icon: const Icon(Icons.search),
),
IconButton(
onPressed: () {},
onPressed: () {
Routemaster.of(context).push('/add-post');
},
icon: const Icon(Icons.add),
),
Builder(
Expand Down
5 changes: 3 additions & 2 deletions lib/features/post/screen/add_post_screen.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:routemaster/routemaster.dart';
Expand All @@ -13,8 +14,8 @@ class AddPostScreen extends ConsumerWidget {

@override
Widget build(BuildContext context, WidgetRef ref) {
double cardHeightWidth = 120;
double iconSize = 60;
double cardHeightWidth = kIsWeb ? 360 : 120;
double iconSize = kIsWeb ? 120 : 60;
final currentTheme = ref.watch(themeNotifierProvider);

return Scaffold(
Expand Down
Loading

0 comments on commit 9fded48

Please sign in to comment.