push
This commit is contained in:
parent
a5ac5b8c82
commit
db4b1f8e00
|
|
@ -12,7 +12,12 @@ class LightThemeConfig {
|
||||||
textTheme: _TextThemeData.data,
|
textTheme: _TextThemeData.data,
|
||||||
cardColor: _colorScheme.surface,
|
cardColor: _colorScheme.surface,
|
||||||
checkboxTheme: CheckboxThemeData(
|
checkboxTheme: CheckboxThemeData(
|
||||||
fillColor: MaterialStateProperty.all<Color>(_colorScheme.primary),
|
fillColor: MaterialStateProperty.resolveWith((states) {
|
||||||
|
if (!states.contains(MaterialState.selected)) {
|
||||||
|
return Colors.transparent;
|
||||||
|
}
|
||||||
|
return _colorScheme.primary;
|
||||||
|
}),
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.circular(4),
|
borderRadius: BorderRadius.circular(4),
|
||||||
),
|
),
|
||||||
|
|
@ -26,7 +31,7 @@ class LightThemeConfig {
|
||||||
static const ColorScheme _colorScheme = ColorScheme(
|
static const ColorScheme _colorScheme = ColorScheme(
|
||||||
primary: _primary,
|
primary: _primary,
|
||||||
primaryContainer: _white,
|
primaryContainer: _white,
|
||||||
secondary: Color(0xFFD61515),
|
secondary: Color(0xFFB20436),
|
||||||
secondaryContainer: _white,
|
secondaryContainer: _white,
|
||||||
surface: _white,
|
surface: _white,
|
||||||
background: _background,
|
background: _background,
|
||||||
|
|
@ -53,7 +58,12 @@ class DarkThemeConfig {
|
||||||
),
|
),
|
||||||
checkboxTheme: CheckboxThemeData(
|
checkboxTheme: CheckboxThemeData(
|
||||||
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
||||||
fillColor: MaterialStateProperty.all<Color>(_colorScheme.primary),
|
fillColor: MaterialStateProperty.resolveWith((states) {
|
||||||
|
if (!states.contains(MaterialState.selected)) {
|
||||||
|
return Colors.transparent;
|
||||||
|
}
|
||||||
|
return _colorScheme.primary;
|
||||||
|
}),
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.circular(4),
|
borderRadius: BorderRadius.circular(4),
|
||||||
),
|
),
|
||||||
|
|
@ -65,7 +75,7 @@ class DarkThemeConfig {
|
||||||
static const ColorScheme _colorScheme = ColorScheme(
|
static const ColorScheme _colorScheme = ColorScheme(
|
||||||
primary: _primary,
|
primary: _primary,
|
||||||
primaryContainer: _white,
|
primaryContainer: _white,
|
||||||
secondary: Color(0xFFE53939),
|
secondary: Color(0xFFB21542),
|
||||||
secondaryContainer: _white,
|
secondaryContainer: _white,
|
||||||
surface: Color(0xFF181B1F),
|
surface: Color(0xFF181B1F),
|
||||||
background: _background,
|
background: _background,
|
||||||
|
|
@ -138,8 +148,8 @@ class _TextThemeData {
|
||||||
extension DidvanColorScheme on ColorScheme {
|
extension DidvanColorScheme on ColorScheme {
|
||||||
// Secondary colors
|
// Secondary colors
|
||||||
Color get secondaryDisabled => brightness == Brightness.dark
|
Color get secondaryDisabled => brightness == Brightness.dark
|
||||||
? const Color(0xFF703838)
|
? const Color(0xFF703848)
|
||||||
: const Color(0xFFFFC8C8);
|
: const Color(0xFFFFC8D7);
|
||||||
|
|
||||||
Color get white => const Color(0xFFFFFFFF);
|
Color get white => const Color(0xFFFFFFFF);
|
||||||
Color get focused => brightness == Brightness.dark
|
Color get focused => brightness == Brightness.dark
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ import 'package:didvan/models/home_page_content/banner.dart';
|
||||||
import 'home_page_list.dart';
|
import 'home_page_list.dart';
|
||||||
|
|
||||||
class MainPageContent {
|
class MainPageContent {
|
||||||
final List<MainPageBannerType> banners;
|
final List<List<MainPageBannerType>> banners;
|
||||||
final List<MainPageList> lists;
|
final List<MainPageList> lists;
|
||||||
final int unread;
|
final int unread;
|
||||||
|
|
||||||
|
|
@ -12,9 +12,13 @@ class MainPageContent {
|
||||||
|
|
||||||
factory MainPageContent.fromJson(Map<String, dynamic> json) {
|
factory MainPageContent.fromJson(Map<String, dynamic> json) {
|
||||||
return MainPageContent(
|
return MainPageContent(
|
||||||
banners: List<MainPageBannerType>.from(json['banners'].map(
|
banners: List<List<MainPageBannerType>>.from(
|
||||||
(x) => MainPageBannerType.fromJson(x),
|
json['banners'].map(
|
||||||
)),
|
(list) => List<MainPageBannerType>.from(
|
||||||
|
list.map((e) => MainPageBannerType.fromJson(e)).toList(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
lists: List<MainPageList>.from(
|
lists: List<MainPageList>.from(
|
||||||
json['lists'].map(
|
json['lists'].map(
|
||||||
(x) => MainPageList.fromJson(x),
|
(x) => MainPageList.fromJson(x),
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class MainCategoryType {
|
||||||
|
final int id;
|
||||||
|
final String label;
|
||||||
|
final IconData icon;
|
||||||
|
|
||||||
|
MainCategoryType({required this.id, required this.label, required this.icon});
|
||||||
|
}
|
||||||
|
|
@ -59,6 +59,7 @@ class _CommentsState extends State<Comments> {
|
||||||
child: Stack(
|
child: Stack(
|
||||||
children: [
|
children: [
|
||||||
DidvanScaffold(
|
DidvanScaffold(
|
||||||
|
hidePlayer: true,
|
||||||
physics: const BouncingScrollPhysics(),
|
physics: const BouncingScrollPhysics(),
|
||||||
backgroundColor: Theme.of(context).colorScheme.surface,
|
backgroundColor: Theme.of(context).colorScheme.surface,
|
||||||
appBarData: _isPage
|
appBarData: _isPage
|
||||||
|
|
|
||||||
|
|
@ -56,6 +56,7 @@ class _DirectState extends State<Direct> {
|
||||||
left: 0,
|
left: 0,
|
||||||
right: 0,
|
right: 0,
|
||||||
child: DidvanScaffold(
|
child: DidvanScaffold(
|
||||||
|
hidePlayer: true,
|
||||||
padding: EdgeInsets.zero,
|
padding: EdgeInsets.zero,
|
||||||
reverse: true,
|
reverse: true,
|
||||||
backgroundColor: Theme.of(context).colorScheme.surface,
|
backgroundColor: Theme.of(context).colorScheme.surface,
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ class _HomeState extends State<Home> with SingleTickerProviderStateMixin {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: LogoAppBar(),
|
appBar: const LogoAppBar(),
|
||||||
body: Consumer<HomeState>(
|
body: Consumer<HomeState>(
|
||||||
builder: (context, state, child) => AnimatedCrossFade(
|
builder: (context, state, child) => AnimatedCrossFade(
|
||||||
duration: DesignConfig.lowAnimationDuration,
|
duration: DesignConfig.lowAnimationDuration,
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,6 @@ class HomeState extends CoreProvier {
|
||||||
int _currentPageIndex = 0;
|
int _currentPageIndex = 0;
|
||||||
String search = '';
|
String search = '';
|
||||||
String lastSearch = '';
|
String lastSearch = '';
|
||||||
bool _showSearchPage = false;
|
|
||||||
Timer? timer;
|
Timer? timer;
|
||||||
String? startDate;
|
String? startDate;
|
||||||
String? endDate;
|
String? endDate;
|
||||||
|
|
@ -48,13 +47,6 @@ class HomeState extends CoreProvier {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
set showSearchPage(bool value) {
|
|
||||||
_showSearchPage = value;
|
|
||||||
notifyListeners();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool get showSearchPage => _showSearchPage;
|
|
||||||
|
|
||||||
set currentPageIndex(int value) {
|
set currentPageIndex(int value) {
|
||||||
_currentPageIndex = value;
|
_currentPageIndex = value;
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
|
|
@ -123,7 +115,7 @@ class HomeState extends CoreProvier {
|
||||||
await service.httpGet();
|
await service.httpGet();
|
||||||
if (service.isSuccess) {
|
if (service.isSuccess) {
|
||||||
lastPage = service.result['lastPage'];
|
lastPage = service.result['lastPage'];
|
||||||
unreadCount = service.result['unread'];
|
unreadCount = service.result['unread'] ?? unreadCount;
|
||||||
results.addAll(
|
results.addAll(
|
||||||
List<OverviewData>.from(
|
List<OverviewData>.from(
|
||||||
service.result['contents'].map(
|
service.result['contents'].map(
|
||||||
|
|
@ -138,10 +130,19 @@ class HomeState extends CoreProvier {
|
||||||
appState = AppState.failed;
|
appState = AppState.failed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final categoryFilters = [
|
||||||
|
CategoryData(id: 1, label: 'پویش افق'),
|
||||||
|
CategoryData(id: 2, label: 'دنیای فولاد'),
|
||||||
|
CategoryData(id: 3, label: 'ویدئوکست'),
|
||||||
|
CategoryData(id: 4, label: 'پادکست'),
|
||||||
|
CategoryData(id: 5, label: 'تحلیلهای راداری'),
|
||||||
|
CategoryData(id: 6, label: 'سها'),
|
||||||
|
];
|
||||||
|
|
||||||
void refresh() {
|
void refresh() {
|
||||||
menuItems.clear();
|
menuItems.clear();
|
||||||
categories.clear();
|
categories.clear();
|
||||||
menuItems.addAll([
|
menuItems = [
|
||||||
MenuItemType(
|
MenuItemType(
|
||||||
label: 'دنیای فولاد',
|
label: 'دنیای فولاد',
|
||||||
asset: Assets.fooladWorld,
|
asset: Assets.fooladWorld,
|
||||||
|
|
@ -160,7 +161,7 @@ class HomeState extends CoreProvier {
|
||||||
MenuItemType(
|
MenuItemType(
|
||||||
label: 'سها',
|
label: 'سها',
|
||||||
asset: Assets.saha,
|
asset: Assets.saha,
|
||||||
link: 'https://didvan.app',
|
link: 'https://saha.didvan.app',
|
||||||
),
|
),
|
||||||
MenuItemType(
|
MenuItemType(
|
||||||
label: 'رادار استارتاپ',
|
label: 'رادار استارتاپ',
|
||||||
|
|
@ -192,9 +193,9 @@ class HomeState extends CoreProvier {
|
||||||
asset: Assets.podcast,
|
asset: Assets.podcast,
|
||||||
link: Routes.podcasts,
|
link: Routes.podcasts,
|
||||||
),
|
),
|
||||||
]);
|
];
|
||||||
|
|
||||||
categories.addAll([
|
categories = [
|
||||||
CategoryData(
|
CategoryData(
|
||||||
id: 1,
|
id: 1,
|
||||||
label: 'اقتصادی',
|
label: 'اقتصادی',
|
||||||
|
|
@ -245,7 +246,6 @@ class HomeState extends CoreProvier {
|
||||||
label: 'کسب و کار',
|
label: 'کسب و کار',
|
||||||
asset: Assets.businessCategoryIcon,
|
asset: Assets.businessCategoryIcon,
|
||||||
),
|
),
|
||||||
]);
|
];
|
||||||
Future.delayed(Duration.zero, notifyListeners);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,10 @@ class MainPageState extends CoreProvier {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (link.startsWith('http')) {
|
if (link.startsWith('http')) {
|
||||||
launchUrlString('$link?accessToken=${RequestService.token}');
|
launchUrlString(
|
||||||
|
'$link?accessToken=${RequestService.token}',
|
||||||
|
mode: LaunchMode.inAppWebView,
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Navigator.of(ActionSheetUtils.context).pushNamed(link, arguments: args);
|
Navigator.of(ActionSheetUtils.context).pushNamed(link, arguments: args);
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ import 'package:didvan/views/widgets/didvan/slider.dart';
|
||||||
import 'package:didvan/views/widgets/skeleton_image.dart';
|
import 'package:didvan/views/widgets/skeleton_image.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
import 'package:url_launcher/url_launcher_string.dart';
|
||||||
|
|
||||||
class MainPageBanner extends StatelessWidget {
|
class MainPageBanner extends StatelessWidget {
|
||||||
final bool isFirst;
|
final bool isFirst;
|
||||||
|
|
@ -12,15 +13,18 @@ class MainPageBanner extends StatelessWidget {
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final state = context.read<MainPageState>();
|
final state = context.read<MainPageState>();
|
||||||
return DidvanSlider(
|
return DidvanSlider(
|
||||||
itemBuilder: (context, index, realIndex) => Padding(
|
itemBuilder: (context, index, realIndex) {
|
||||||
|
final item = state.content.banners[isFirst ? 0 : 1][index];
|
||||||
|
return Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 4),
|
padding: const EdgeInsets.symmetric(horizontal: 4),
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
onTap: () => state.content.banners[index].link,
|
onTap: item.link == null ? null : () => launchUrlString(item.link!),
|
||||||
child: SkeletonImage(
|
child: SkeletonImage(
|
||||||
imageUrl: state.content.banners[index].image,
|
imageUrl: item.image,
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
itemCount: state.content.banners.length,
|
itemCount: state.content.banners.length,
|
||||||
viewportFraction: 1,
|
viewportFraction: 1,
|
||||||
enableIndicator: true,
|
enableIndicator: true,
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
|
import 'package:collection/collection.dart';
|
||||||
import 'package:didvan/models/enums.dart';
|
import 'package:didvan/models/enums.dart';
|
||||||
import 'package:didvan/views/home/home_state.dart';
|
import 'package:didvan/views/home/home_state.dart';
|
||||||
import 'package:didvan/views/home/search/widgets/search_result_item.dart';
|
import 'package:didvan/views/home/search/widgets/search_result_item.dart';
|
||||||
|
import 'package:didvan/views/widgets/categories_list.dart';
|
||||||
import 'package:didvan/views/widgets/state_handlers/empty_list.dart';
|
import 'package:didvan/views/widgets/state_handlers/empty_list.dart';
|
||||||
import 'package:didvan/views/widgets/state_handlers/state_handler.dart';
|
import 'package:didvan/views/widgets/state_handlers/state_handler.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
@ -15,16 +17,19 @@ class SearchPage extends StatelessWidget {
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
height: MediaQuery.of(context).size.height,
|
height: MediaQuery.of(context).size.height,
|
||||||
width: MediaQuery.of(context).size.width,
|
width: MediaQuery.of(context).size.width,
|
||||||
child: StateHandler<HomeState>(
|
child: Stack(
|
||||||
|
children: [
|
||||||
|
StateHandler<HomeState>(
|
||||||
state: state,
|
state: state,
|
||||||
enableEmptyState:
|
enableEmptyState:
|
||||||
state.appState == AppState.idle && state.results.isEmpty,
|
state.appState == AppState.idle && state.results.isEmpty,
|
||||||
emptyState: const EmptyList(),
|
emptyState: const EmptyList(),
|
||||||
onRetry: () => state.searchAll(page: state.page),
|
onRetry: () => state.searchAll(page: state.page),
|
||||||
builder: (context, state) => ListView.builder(
|
builder: (context, state) => ListView.builder(
|
||||||
padding: const EdgeInsets.all(16),
|
padding: const EdgeInsets.all(16)
|
||||||
|
.copyWith(top: state.selectedCats.length <= 1 ? 72 : 16),
|
||||||
itemBuilder: (context, index) => Padding(
|
itemBuilder: (context, index) => Padding(
|
||||||
padding: const EdgeInsets.only(bottom: 16),
|
padding: const EdgeInsets.only(bottom: 8),
|
||||||
child: SearchResultItem(
|
child: SearchResultItem(
|
||||||
item: state.results[index],
|
item: state.results[index],
|
||||||
),
|
),
|
||||||
|
|
@ -32,6 +37,23 @@ class SearchPage extends StatelessWidget {
|
||||||
itemCount: state.results.length,
|
itemCount: state.results.length,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
CategoriesList(
|
||||||
|
isColapsed: state.selectedCats.length <= 1,
|
||||||
|
selectedCats: state.selectedCats,
|
||||||
|
categories: state.categoryFilters,
|
||||||
|
onSelected: (id) {
|
||||||
|
state.selectedCats.clear();
|
||||||
|
final cat = state.categoryFilters
|
||||||
|
.firstWhereOrNull((element) => element.id == id);
|
||||||
|
if (cat != null) {
|
||||||
|
state.selectedCats.add(cat);
|
||||||
|
}
|
||||||
|
state.searchAll(page: 1);
|
||||||
|
},
|
||||||
|
top: 0,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
import 'package:didvan/config/design_config.dart';
|
import 'package:didvan/config/design_config.dart';
|
||||||
import 'package:didvan/config/theme_data.dart';
|
import 'package:didvan/config/theme_data.dart';
|
||||||
|
import 'package:didvan/services/network/request.dart';
|
||||||
import 'package:didvan/views/home/home_state.dart';
|
import 'package:didvan/views/home/home_state.dart';
|
||||||
import 'package:didvan/views/widgets/didvan/text.dart';
|
import 'package:didvan/views/widgets/didvan/text.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
@ -12,7 +13,10 @@ class MainCategories extends StatelessWidget {
|
||||||
|
|
||||||
void _onTap(String link, BuildContext context) {
|
void _onTap(String link, BuildContext context) {
|
||||||
if (link.startsWith('http')) {
|
if (link.startsWith('http')) {
|
||||||
launchUrlString(link);
|
launchUrlString(
|
||||||
|
'$link?accessToken=${RequestService.token}',
|
||||||
|
mode: LaunchMode.inAppWebView,
|
||||||
|
);
|
||||||
} else if (link.startsWith('tab-')) {
|
} else if (link.startsWith('tab-')) {
|
||||||
final state = context.read<HomeState>();
|
final state = context.read<HomeState>();
|
||||||
state.currentPageIndex = 1;
|
state.currentPageIndex = 1;
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@ class _DirectListState extends State<DirectList> {
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Consumer<DirectListState>(
|
return Consumer<DirectListState>(
|
||||||
builder: (context, state, child) => DidvanScaffold(
|
builder: (context, state, child) => DidvanScaffold(
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: 16),
|
||||||
appBarData: AppBarData(
|
appBarData: AppBarData(
|
||||||
hasBack: true,
|
hasBack: true,
|
||||||
title: 'پیامها',
|
title: 'پیامها',
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,12 @@ class _EditProfileState extends State<EditProfile> {
|
||||||
Form(
|
Form(
|
||||||
key: _formKey,
|
key: _formKey,
|
||||||
child: DidvanScaffold(
|
child: DidvanScaffold(
|
||||||
padding: const EdgeInsets.only(left: 16, right: 16, bottom: 92),
|
padding: const EdgeInsets.only(
|
||||||
|
top: 16,
|
||||||
|
left: 16,
|
||||||
|
right: 16,
|
||||||
|
bottom: 92,
|
||||||
|
),
|
||||||
appBarData: AppBarData(title: 'ویرایش پروفایل'),
|
appBarData: AppBarData(title: 'ویرایش پروفایل'),
|
||||||
children: [
|
children: [
|
||||||
const ProfilePhoto(),
|
const ProfilePhoto(),
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,7 @@ class _GeneralSettingsState extends State<GeneralSettings> {
|
||||||
onRetry: () {},
|
onRetry: () {},
|
||||||
state: context.read<GeneralSettingsState>(),
|
state: context.read<GeneralSettingsState>(),
|
||||||
builder: (context, state) => DidvanScaffold(
|
builder: (context, state) => DidvanScaffold(
|
||||||
|
padding: const EdgeInsets.all(16),
|
||||||
appBarData: AppBarData(hasBack: true, title: 'تنظیمات'),
|
appBarData: AppBarData(hasBack: true, title: 'تنظیمات'),
|
||||||
children: [
|
children: [
|
||||||
DidvanCard(
|
DidvanCard(
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ class ProfilePage extends StatelessWidget {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return DidvanScaffold(
|
return DidvanScaffold(
|
||||||
|
padding: const EdgeInsets.all(16),
|
||||||
appBarData: AppBarData(
|
appBarData: AppBarData(
|
||||||
title: 'تنظیمات',
|
title: 'تنظیمات',
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -193,7 +193,7 @@ class _RadarState extends State<Radar> {
|
||||||
child: SearchField(
|
child: SearchField(
|
||||||
focusNode: _focusNode,
|
focusNode: _focusNode,
|
||||||
isFiltered: state.filtering,
|
isFiltered: state.filtering,
|
||||||
title: 'رادار',
|
title: 'افق',
|
||||||
onChanged: _onChanged,
|
onChanged: _onChanged,
|
||||||
onFilterButtonPressed: _showFilterBottomSheet,
|
onFilterButtonPressed: _showFilterBottomSheet,
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -88,9 +88,17 @@ class _CategoriesListState extends State<CategoriesList> {
|
||||||
firstChild: const SizedBox(),
|
firstChild: const SizedBox(),
|
||||||
secondChild: Container(
|
secondChild: Container(
|
||||||
height: 60 + d.padding.top,
|
height: 60 + d.padding.top,
|
||||||
|
margin: const EdgeInsets.only(bottom: 20),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Theme.of(context).colorScheme.surface,
|
color: Theme.of(context).colorScheme.surface,
|
||||||
boxShadow: DesignConfig.defaultShadow,
|
boxShadow: [
|
||||||
|
BoxShadow(
|
||||||
|
color: const Color(0XFF1B3C59).withOpacity(0.15),
|
||||||
|
blurRadius: 8,
|
||||||
|
spreadRadius: 0,
|
||||||
|
offset: const Offset(0, 8),
|
||||||
|
)
|
||||||
|
],
|
||||||
),
|
),
|
||||||
child: AnimatedVisibility(
|
child: AnimatedVisibility(
|
||||||
isVisible: widget.isColapsed,
|
isVisible: widget.isColapsed,
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,7 @@ class DidvanScaffold extends StatefulWidget {
|
||||||
final ScrollPhysics? physics;
|
final ScrollPhysics? physics;
|
||||||
final ScrollController? scrollController;
|
final ScrollController? scrollController;
|
||||||
final bool showSliversFirst;
|
final bool showSliversFirst;
|
||||||
|
final bool hidePlayer;
|
||||||
|
|
||||||
const DidvanScaffold({
|
const DidvanScaffold({
|
||||||
Key? key,
|
Key? key,
|
||||||
|
|
@ -44,6 +45,7 @@ class DidvanScaffold extends StatefulWidget {
|
||||||
this.reverse = false,
|
this.reverse = false,
|
||||||
this.scrollController,
|
this.scrollController,
|
||||||
this.showSliversFirst = false,
|
this.showSliversFirst = false,
|
||||||
|
this.hidePlayer = false,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
@ -138,6 +140,7 @@ class _DidvanScaffoldState extends State<DidvanScaffold> {
|
||||||
appBarData: widget.appBarData!,
|
appBarData: widget.appBarData!,
|
||||||
scrollController: _scrollController,
|
scrollController: _scrollController,
|
||||||
),
|
),
|
||||||
|
if (!widget.hidePlayer)
|
||||||
const Positioned(
|
const Positioned(
|
||||||
bottom: 20,
|
bottom: 20,
|
||||||
left: 0,
|
left: 0,
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@ import 'dart:async';
|
||||||
|
|
||||||
import 'package:didvan/config/theme_data.dart';
|
import 'package:didvan/config/theme_data.dart';
|
||||||
import 'package:didvan/constants/app_icons.dart';
|
import 'package:didvan/constants/app_icons.dart';
|
||||||
import 'package:didvan/models/category.dart';
|
|
||||||
import 'package:didvan/models/view/action_sheet_data.dart';
|
import 'package:didvan/models/view/action_sheet_data.dart';
|
||||||
import 'package:didvan/routes/routes.dart';
|
import 'package:didvan/routes/routes.dart';
|
||||||
import 'package:didvan/utils/action_sheet.dart';
|
import 'package:didvan/utils/action_sheet.dart';
|
||||||
|
|
@ -12,14 +11,12 @@ import 'package:didvan/views/widgets/didvan/checkbox.dart';
|
||||||
import 'package:didvan/views/widgets/item_title.dart';
|
import 'package:didvan/views/widgets/item_title.dart';
|
||||||
import 'package:didvan/views/widgets/search_field.dart';
|
import 'package:didvan/views/widgets/search_field.dart';
|
||||||
import 'package:didvan/views/widgets/didvan/icon_button.dart';
|
import 'package:didvan/views/widgets/didvan/icon_button.dart';
|
||||||
import 'package:didvan/views/widgets/didvan/text.dart';
|
|
||||||
import 'package:didvan/views/widgets/logos/didvan_vertical_logo.dart';
|
import 'package:didvan/views/widgets/logos/didvan_vertical_logo.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_svg/svg.dart';
|
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
class LogoAppBar extends StatelessWidget implements PreferredSizeWidget {
|
class LogoAppBar extends StatelessWidget implements PreferredSizeWidget {
|
||||||
LogoAppBar({Key? key}) : super(key: key);
|
const LogoAppBar({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Size get preferredSize => const Size(double.infinity, 144);
|
Size get preferredSize => const Size(double.infinity, 144);
|
||||||
|
|
@ -33,7 +30,9 @@ class LogoAppBar extends StatelessWidget implements PreferredSizeWidget {
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
borderRadius: const BorderRadius.only(bottomLeft: Radius.circular(20)),
|
borderRadius: const BorderRadius.only(bottomLeft: Radius.circular(20)),
|
||||||
color: Theme.of(context).colorScheme.surface,
|
color: Theme.of(context).colorScheme.surface,
|
||||||
boxShadow: [
|
boxShadow: state.currentPageIndex == 1 || state.filtering
|
||||||
|
? null
|
||||||
|
: [
|
||||||
BoxShadow(
|
BoxShadow(
|
||||||
color: const Color(0XFF1B3C59).withOpacity(0.15),
|
color: const Color(0XFF1B3C59).withOpacity(0.15),
|
||||||
blurRadius: 8,
|
blurRadius: 8,
|
||||||
|
|
@ -125,15 +124,6 @@ class LogoAppBar extends StatelessWidget implements PreferredSizeWidget {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
final categoryFilters = [
|
|
||||||
CategoryData(id: 1, label: 'پویش افق'),
|
|
||||||
CategoryData(id: 2, label: 'دنیای فولاد'),
|
|
||||||
CategoryData(id: 3, label: 'ویدئوکست'),
|
|
||||||
CategoryData(id: 4, label: 'پادکست'),
|
|
||||||
CategoryData(id: 1, label: 'تحلیلهای راداری'),
|
|
||||||
CategoryData(id: 1, label: 'سها'),
|
|
||||||
];
|
|
||||||
|
|
||||||
Future<void> _showFilterBottomSheet(BuildContext context) async {
|
Future<void> _showFilterBottomSheet(BuildContext context) async {
|
||||||
final state = context.read<HomeState>();
|
final state = context.read<HomeState>();
|
||||||
await ActionSheetUtils.showBottomSheet(
|
await ActionSheetUtils.showBottomSheet(
|
||||||
|
|
@ -185,18 +175,19 @@ class LogoAppBar extends StatelessWidget implements PreferredSizeWidget {
|
||||||
const SizedBox(height: 12),
|
const SizedBox(height: 12),
|
||||||
Wrap(
|
Wrap(
|
||||||
children: [
|
children: [
|
||||||
for (var i = 0; i < categoryFilters.length; i++)
|
for (var i = 0; i < state.categoryFilters.length; i++)
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: (MediaQuery.of(context).size.width - 40) / 2,
|
width: (MediaQuery.of(context).size.width - 40) / 2,
|
||||||
child: DidvanCheckbox(
|
child: DidvanCheckbox(
|
||||||
title: categoryFilters[i].label,
|
title: state.categoryFilters[i].label,
|
||||||
value: state.selectedCats.contains(state.categories[i]),
|
value:
|
||||||
|
state.selectedCats.contains(state.categoryFilters[i]),
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
if (value) {
|
if (value) {
|
||||||
state.selectedCats.add(state.categories[i]);
|
state.selectedCats.add(state.categoryFilters[i]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
state.selectedCats.remove(state.categories[i]);
|
state.selectedCats.remove(state.categoryFilters[i]);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
@ -273,45 +264,45 @@ class LogoAppBar extends StatelessWidget implements PreferredSizeWidget {
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
class _BottomSheetItem extends StatelessWidget {
|
// class _BottomSheetItem extends StatelessWidget {
|
||||||
final String icon;
|
// final String icon;
|
||||||
final String title;
|
// final String title;
|
||||||
final bool enabled;
|
// final bool enabled;
|
||||||
final VoidCallback onTap;
|
// final VoidCallback onTap;
|
||||||
const _BottomSheetItem({
|
// const _BottomSheetItem({
|
||||||
required this.icon,
|
// required this.icon,
|
||||||
required this.title,
|
// required this.title,
|
||||||
this.enabled = false,
|
// this.enabled = false,
|
||||||
required this.onTap,
|
// required this.onTap,
|
||||||
});
|
// });
|
||||||
|
|
||||||
@override
|
// @override
|
||||||
Widget build(BuildContext context) {
|
// Widget build(BuildContext context) {
|
||||||
return GestureDetector(
|
// return GestureDetector(
|
||||||
onTap: enabled ? onTap : null,
|
// onTap: enabled ? onTap : null,
|
||||||
child: Container(
|
// child: Container(
|
||||||
color: Colors.transparent,
|
// color: Colors.transparent,
|
||||||
child: Row(
|
// child: Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
// crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
children: [
|
// children: [
|
||||||
SvgPicture.asset(
|
// SvgPicture.asset(
|
||||||
icon,
|
// icon,
|
||||||
theme: SvgTheme(
|
// theme: SvgTheme(
|
||||||
currentColor: enabled
|
// currentColor: enabled
|
||||||
? Theme.of(context).colorScheme.title
|
// ? Theme.of(context).colorScheme.title
|
||||||
: Theme.of(context).colorScheme.disabledText,
|
// : Theme.of(context).colorScheme.disabledText,
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
const SizedBox(width: 8),
|
// const SizedBox(width: 8),
|
||||||
DidvanText(
|
// DidvanText(
|
||||||
title,
|
// title,
|
||||||
color: enabled
|
// color: enabled
|
||||||
? Theme.of(context).colorScheme.title
|
// ? Theme.of(context).colorScheme.title
|
||||||
: Theme.of(context).colorScheme.disabledText,
|
// : Theme.of(context).colorScheme.disabledText,
|
||||||
),
|
// ),
|
||||||
],
|
// ],
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
|
||||||
|
|
@ -75,6 +75,7 @@ class MultitypeOverview extends StatelessWidget {
|
||||||
item.id,
|
item.id,
|
||||||
args: const StudioRequestArgs(page: 0, type: 'podcast'),
|
args: const StudioRequestArgs(page: 0, type: 'podcast'),
|
||||||
);
|
);
|
||||||
|
MediaService.currentPodcast = state.studio;
|
||||||
MediaService.handleAudioPlayback(
|
MediaService.handleAudioPlayback(
|
||||||
audioSource: item.link,
|
audioSource: item.link,
|
||||||
id: item.id,
|
id: item.id,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue