123 lines
3.8 KiB
Dart
123 lines
3.8 KiB
Dart
import 'package:didvan/views/home/media/podcast_tab_page.dart';
|
|
import 'package:didvan/views/home/media/videocast_tab_page.dart';
|
|
import 'package:didvan/views/widgets/didvan/text.dart';
|
|
import 'package:didvan/views/home/main/widgets/banner.dart';
|
|
import 'package:didvan/views/widgets/home_app_bar.dart';
|
|
import 'package:didvan/views/widgets/custom_media_tab_bar.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
class MediaPage extends StatefulWidget {
|
|
const MediaPage({super.key});
|
|
|
|
@override
|
|
State<MediaPage> createState() => _MediaPageState();
|
|
}
|
|
|
|
class _MediaPageState extends State<MediaPage> {
|
|
int _currentIndex = 0;
|
|
final PageController _pageController = PageController();
|
|
|
|
final List<String> _categories = [
|
|
'پادکست',
|
|
'ویدیوکست',
|
|
'فولادینفو',
|
|
'اینفوگرافی',
|
|
];
|
|
|
|
final List<String> _iconPaths = [
|
|
'lib/assets/icons/microphone-2.svg',
|
|
'lib/assets/icons/video-play.svg',
|
|
'lib/assets/icons/streamline-plump_factory-plant.svg',
|
|
'lib/assets/icons/hugeicons_chart-02.svg',
|
|
];
|
|
|
|
void _onTabTapped(int index) {
|
|
setState(() {
|
|
_currentIndex = index;
|
|
});
|
|
_pageController.animateToPage(
|
|
index,
|
|
duration: const Duration(milliseconds: 300),
|
|
curve: Curves.easeInOut,
|
|
);
|
|
}
|
|
|
|
@override
|
|
void dispose() {
|
|
_pageController.dispose();
|
|
super.dispose();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
backgroundColor: Theme.of(context).colorScheme.background,
|
|
body: SafeArea(
|
|
child: Column(
|
|
children: [
|
|
const HomeAppBar(
|
|
showBackButton: false,
|
|
showSearchField: true,
|
|
),
|
|
CustomMediaTabBar(
|
|
currentIndex: _currentIndex,
|
|
onTap: _onTabTapped,
|
|
categories: _categories,
|
|
iconPaths: _iconPaths,
|
|
customIndicatorPath: 'assets/icons/tab_indicator.svg',
|
|
),
|
|
Container(
|
|
width: double.infinity,
|
|
padding:
|
|
const EdgeInsets.symmetric(horizontal: 7),
|
|
child: Container(
|
|
height: 2,
|
|
color: const Color.fromRGBO(184, 184, 184, 1),
|
|
),
|
|
),
|
|
Expanded(
|
|
child: PageView(
|
|
controller: _pageController,
|
|
onPageChanged: (index) {
|
|
setState(() {
|
|
_currentIndex = index;
|
|
});
|
|
},
|
|
children: [
|
|
const PodcastTabPage(key: ValueKey('PodcastTabPage')),
|
|
const VideoCastTabPage(key: ValueKey('VideoCastTabPage')),
|
|
const SingleChildScrollView(
|
|
key: ValueKey('MainPageBanner'),
|
|
child: Padding(
|
|
padding: EdgeInsets.symmetric(
|
|
horizontal: 16.0, vertical: 16.0),
|
|
child: MainPageBanner(isFirst: true),
|
|
),
|
|
),
|
|
Center(
|
|
key: const ValueKey('InfographyPage'),
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
Icon(
|
|
Icons.photo_library,
|
|
size: 48,
|
|
color: Theme.of(context).colorScheme.primary,
|
|
),
|
|
const SizedBox(height: 8),
|
|
DidvanText(
|
|
'صفحه اینفوگرافی',
|
|
style: Theme.of(context).textTheme.titleSmall,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
} |