|
@ -8,7 +8,9 @@ import 'package:sonnat/core/select_language/cubit/select_language_cubit.dart'; |
|
|
import 'package:sonnat/core/select_language/screen/select_language_screen.dart'; |
|
|
import 'package:sonnat/core/select_language/screen/select_language_screen.dart'; |
|
|
import 'package:sonnat/core/utils/app_constants.dart'; |
|
|
import 'package:sonnat/core/utils/app_constants.dart'; |
|
|
import 'package:sonnat/core/utils/base_cubit_type.dart'; |
|
|
import 'package:sonnat/core/utils/base_cubit_type.dart'; |
|
|
|
|
|
import 'package:sonnat/core/utils/initializer.dart'; |
|
|
import 'package:sonnat/core/widgets/loading_list_widget.dart'; |
|
|
import 'package:sonnat/core/widgets/loading_list_widget.dart'; |
|
|
|
|
|
import 'package:sonnat/core/widgets/more_options_widget.dart'; |
|
|
import 'package:sonnat/features/about_us/about_us_screen.dart'; |
|
|
import 'package:sonnat/features/about_us/about_us_screen.dart'; |
|
|
import 'package:sonnat/features/posts/cubit/posts_cubit.dart'; |
|
|
import 'package:sonnat/features/posts/cubit/posts_cubit.dart'; |
|
|
import 'package:sonnat/features/posts/widgets/filter_item_widget.dart'; |
|
|
import 'package:sonnat/features/posts/widgets/filter_item_widget.dart'; |
|
@ -92,11 +94,24 @@ class _PostsScreenState extends State<PostsScreen> { |
|
|
_loading = true; |
|
|
_loading = true; |
|
|
break; |
|
|
break; |
|
|
} |
|
|
} |
|
|
return Column( |
|
|
|
|
|
|
|
|
return CustomScrollView( |
|
|
|
|
|
controller: _controller, |
|
|
|
|
|
slivers: [ |
|
|
|
|
|
SliverAppBar( |
|
|
|
|
|
floating: true, |
|
|
|
|
|
elevation: 0, |
|
|
|
|
|
backgroundColor: const Color(0xffE7E7F5), |
|
|
|
|
|
automaticallyImplyLeading: false, |
|
|
|
|
|
forceElevated: false, |
|
|
|
|
|
shadowColor: Colors.transparent, |
|
|
|
|
|
bottom: PreferredSize( |
|
|
|
|
|
preferredSize: const Size.fromHeight(95), |
|
|
|
|
|
child: Column( |
|
|
children: [ |
|
|
children: [ |
|
|
SizedBox(height: context.height * 26 / AppConstants.instance.appHeight), |
|
|
SizedBox(height: context.height * 26 / AppConstants.instance.appHeight), |
|
|
Padding( |
|
|
Padding( |
|
|
padding: EdgeInsets.symmetric(horizontal: context.width * 26 / AppConstants.instance.appWidth), |
|
|
|
|
|
|
|
|
padding: |
|
|
|
|
|
EdgeInsets.symmetric(horizontal: context.width * 26 / AppConstants.instance.appWidth), |
|
|
child: _searchMode |
|
|
child: _searchMode |
|
|
? Row( |
|
|
? Row( |
|
|
children: [ |
|
|
children: [ |
|
@ -162,8 +177,10 @@ class _PostsScreenState extends State<PostsScreen> { |
|
|
onTap: () { |
|
|
onTap: () { |
|
|
Navigator.pop(context); |
|
|
Navigator.pop(context); |
|
|
}, |
|
|
}, |
|
|
child: SvgPicture.asset( |
|
|
|
|
|
'ic_back'.svgPath, |
|
|
|
|
|
|
|
|
child: RotatedBox( |
|
|
|
|
|
quarterTurns: |
|
|
|
|
|
Initializer.instance.getTextDirection() == TextDirection.ltr ? 90 : 0, |
|
|
|
|
|
child: SvgPicture.asset('ic_back'.svgPath), |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
@ -227,7 +244,8 @@ class _PostsScreenState extends State<PostsScreen> { |
|
|
SizedBox( |
|
|
SizedBox( |
|
|
height: context.height * 31 / AppConstants.instance.appHeight, |
|
|
height: context.height * 31 / AppConstants.instance.appHeight, |
|
|
child: ListView.builder( |
|
|
child: ListView.builder( |
|
|
padding: EdgeInsetsDirectional.only(start: context.width * 26 / AppConstants.instance.appWidth), |
|
|
|
|
|
|
|
|
padding: |
|
|
|
|
|
EdgeInsetsDirectional.only(start: context.width * 26 / AppConstants.instance.appWidth), |
|
|
itemBuilder: (context, index) { |
|
|
itemBuilder: (context, index) { |
|
|
return GestureDetector( |
|
|
return GestureDetector( |
|
|
onTap: () { |
|
|
onTap: () { |
|
@ -244,12 +262,19 @@ class _PostsScreenState extends State<PostsScreen> { |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
SizedBox(height: context.height * 26 / AppConstants.instance.appHeight), |
|
|
SizedBox(height: context.height * 26 / AppConstants.instance.appHeight), |
|
|
if (_loading) |
|
|
|
|
|
const Expanded(child: LoadingListWidget()) |
|
|
|
|
|
else |
|
|
|
|
|
Expanded( |
|
|
|
|
|
child: ListView.builder( |
|
|
|
|
|
controller: _controller, |
|
|
|
|
|
|
|
|
], |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
SliverList( |
|
|
|
|
|
delegate: SliverChildBuilderDelegate( |
|
|
|
|
|
(context, index) { |
|
|
|
|
|
if (_loading) { |
|
|
|
|
|
return const Expanded(child: LoadingListWidget()); |
|
|
|
|
|
} |
|
|
|
|
|
return ListView.builder( |
|
|
|
|
|
shrinkWrap: true, |
|
|
|
|
|
physics: NeverScrollableScrollPhysics(), |
|
|
itemBuilder: (context, index) { |
|
|
itemBuilder: (context, index) { |
|
|
if (_searchMode) { |
|
|
if (_searchMode) { |
|
|
return GestureDetector( |
|
|
return GestureDetector( |
|
@ -263,8 +288,11 @@ class _PostsScreenState extends State<PostsScreen> { |
|
|
); |
|
|
); |
|
|
}, |
|
|
}, |
|
|
itemCount: _searchMode ? _cubit.searchedList.length : _cubit.postList.length, |
|
|
itemCount: _searchMode ? _cubit.searchedList.length : _cubit.postList.length, |
|
|
|
|
|
); |
|
|
|
|
|
}, |
|
|
|
|
|
childCount: 1, |
|
|
|
|
|
), |
|
|
), |
|
|
), |
|
|
) |
|
|
|
|
|
], |
|
|
], |
|
|
); |
|
|
); |
|
|
}, |
|
|
}, |
|
@ -362,25 +390,3 @@ class FilterItem { |
|
|
|
|
|
|
|
|
const FilterItem({required this.selected, required this.title}); |
|
|
const FilterItem({required this.selected, required this.title}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
class MoreOptionsWidget extends StatelessWidget { |
|
|
|
|
|
final String title; |
|
|
|
|
|
final Function() onTap; |
|
|
|
|
|
|
|
|
|
|
|
const MoreOptionsWidget({super.key, required this.title, required this.onTap}); |
|
|
|
|
|
|
|
|
|
|
|
@override |
|
|
|
|
|
Widget build(BuildContext context) { |
|
|
|
|
|
return GestureDetector( |
|
|
|
|
|
onTap: onTap, |
|
|
|
|
|
child: Text( |
|
|
|
|
|
title, |
|
|
|
|
|
style: const TextStyle( |
|
|
|
|
|
color: Color(0xff222D4E), |
|
|
|
|
|
fontSize: 16, |
|
|
|
|
|
fontWeight: FontWeight.bold, |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|