D1APP-99 sort bottom sheet
This commit is contained in:
parent
09b987e6a6
commit
c2e7e038e4
|
|
@ -21,7 +21,7 @@ class ServerDataProvider {
|
|||
directTypes.add(MapEntry(types[i]['id'], types[i]['label']));
|
||||
}
|
||||
} else {
|
||||
throw 'Fetchin direct types failed!';
|
||||
throw 'Fetching direct types failed!';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ import 'package:didvan/views/home/settings/direct_list/direct_list_state.dart';
|
|||
import 'package:didvan/views/home/settings/general_settings/settings.dart';
|
||||
import 'package:didvan/views/home/settings/general_settings/settings_state.dart';
|
||||
import 'package:didvan/views/home/settings/profile/profile.dart';
|
||||
import 'package:didvan/views/home/studio/studio_state.dart';
|
||||
import 'package:didvan/views/splash/splash.dart';
|
||||
import 'package:didvan/routes/routes.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
|
@ -57,6 +58,9 @@ class RouteGenerator {
|
|||
ChangeNotifierProvider<NewsState>(
|
||||
create: (context) => NewsState(),
|
||||
),
|
||||
ChangeNotifierProvider<StudioState>(
|
||||
create: (context) => StudioState(),
|
||||
),
|
||||
],
|
||||
child: const Home(),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -1,10 +1,17 @@
|
|||
import 'package:didvan/constants/app_icons.dart';
|
||||
import 'package:didvan/models/view/action_sheet_data.dart';
|
||||
import 'package:didvan/utils/action_sheet.dart';
|
||||
import 'package:didvan/views/home/studio/studio_state.dart';
|
||||
import 'package:didvan/views/home/studio/widgets/slider.dart';
|
||||
import 'package:didvan/views/home/studio/widgets/tab_bar.dart';
|
||||
import 'package:didvan/views/home/widgets/logo_app_bar.dart';
|
||||
import 'package:didvan/views/home/widgets/search_field.dart';
|
||||
import 'package:didvan/views/widgets/didvan/divider.dart';
|
||||
import 'package:didvan/views/widgets/didvan/icon_button.dart';
|
||||
import 'package:didvan/views/widgets/didvan/radial_button.dart';
|
||||
import 'package:didvan/views/widgets/item_title.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class Studio extends StatefulWidget {
|
||||
const Studio({Key? key}) : super(key: key);
|
||||
|
|
@ -51,7 +58,73 @@ class _StudioState extends State<Studio> {
|
|||
const SliverToBoxAdapter(
|
||||
child: StudioSlider(),
|
||||
),
|
||||
const SliverPadding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 16),
|
||||
sliver: SliverToBoxAdapter(
|
||||
child: DidvanDivider(
|
||||
verticalPadding: 0,
|
||||
),
|
||||
),
|
||||
),
|
||||
SliverPadding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
sliver: SliverToBoxAdapter(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
const ItemTitle(title: 'تازهترینها'),
|
||||
DidvanIconButton(
|
||||
gestureSize: 36,
|
||||
icon: DidvanIcons.sort_regular,
|
||||
onPressed: _showSortDialog,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
void _showSortDialog() {
|
||||
final state = context.read<StudioState>();
|
||||
ActionSheetUtils.showBottomSheet(
|
||||
data: ActionSheetData(
|
||||
content: StatefulBuilder(
|
||||
builder: (context, setState) => Column(
|
||||
children: [
|
||||
DidvanRadialButton(
|
||||
title: 'جدیدترینها',
|
||||
onSelected: () => setState(
|
||||
() => state.selectedSortTypeIndex = 0,
|
||||
),
|
||||
value: state.selectedSortTypeIndex == 0,
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
DidvanRadialButton(
|
||||
title: 'پربازدیدترینها',
|
||||
onSelected: () => setState(
|
||||
() => state.selectedSortTypeIndex = 1,
|
||||
),
|
||||
value: state.selectedSortTypeIndex == 1,
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
DidvanRadialButton(
|
||||
title: 'پربحثترینها',
|
||||
onSelected: () => setState(
|
||||
() => state.selectedSortTypeIndex = 2,
|
||||
),
|
||||
value: state.selectedSortTypeIndex == 2,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
title: 'مرتبسازی',
|
||||
titleIcon: DidvanIcons.sort_regular,
|
||||
hasDismissButton: false,
|
||||
confrimTitle: 'مرتب سازی',
|
||||
onConfirmed: () {},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
import 'package:didvan/providers/core_provider.dart';
|
||||
|
||||
class StudioState extends CoreProvier {
|
||||
int selectedSortTypeIndex = 0;
|
||||
|
||||
bool videosSelected = true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,54 @@
|
|||
import 'package:didvan/config/theme_data.dart';
|
||||
import 'package:didvan/views/widgets/didvan/text.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class DidvanRadialButton extends StatelessWidget {
|
||||
final String title;
|
||||
final VoidCallback onSelected;
|
||||
final bool value;
|
||||
const DidvanRadialButton({
|
||||
Key? key,
|
||||
required this.title,
|
||||
required this.onSelected,
|
||||
required this.value,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GestureDetector(
|
||||
onTap: value ? null : onSelected,
|
||||
child: Container(
|
||||
color: Colors.transparent,
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.all(4),
|
||||
height: 24,
|
||||
width: 24,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
border: Border.all(
|
||||
color: value
|
||||
? Theme.of(context).colorScheme.secondary
|
||||
: Theme.of(context).colorScheme.text,
|
||||
),
|
||||
),
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
height: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
color: value
|
||||
? Theme.of(context).colorScheme.secondary
|
||||
: Colors.transparent,
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
DidvanText(title),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue