120 lines
3.9 KiB
Dart
120 lines
3.9 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
import 'package:aslan/chatvibe_managers/app_general_manager.dart';
|
|
import 'package:provider/provider.dart';
|
|
import 'package:aslan/app_localizations.dart';
|
|
import 'package:aslan/chatvibe_features/gift/activity/gift_tab_activity_item_page.dart';
|
|
|
|
class GiftTabActivityPage extends StatefulWidget {
|
|
String type;
|
|
bool isDark = true;
|
|
Function(int checkedIndex,String activityId) checkedCall;
|
|
|
|
GiftTabActivityPage(
|
|
this.type,
|
|
this.checkedCall, {
|
|
super.key,
|
|
this.isDark = true,
|
|
});
|
|
|
|
@override
|
|
_GiftTabActivityPageState createState() => _GiftTabActivityPageState();
|
|
}
|
|
|
|
class _GiftTabActivityPageState extends State<GiftTabActivityPage>
|
|
with SingleTickerProviderStateMixin {
|
|
late TabController _tabController;
|
|
int checkedIndex = 0;
|
|
|
|
final List<Widget> _pages = [];
|
|
final List<Widget> _tabs = [];
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
Provider.of<AppGeneralManager>(
|
|
context,
|
|
listen: false,
|
|
).activityGiftByTab.keys.forEach((km) {
|
|
if (km == "2020752123128635394") {
|
|
_pages.add(
|
|
GiftTabActivityItemPage("2020752123128635394", (int checkedI) {
|
|
widget.checkedCall.call(checkedI,"2020752123128635394");
|
|
}),
|
|
);
|
|
} else if (km == "1975233764843642882") {
|
|
_pages.add(
|
|
GiftTabActivityItemPage("1975233764843642882", (int checkedI) {
|
|
widget.checkedCall.call(checkedI,"1975233764843642882");
|
|
}),
|
|
);
|
|
} else if (km == "2021548434972721154") {
|
|
_pages.add(
|
|
GiftTabActivityItemPage("2021548434972721154", (int checkedI) {
|
|
widget.checkedCall.call(checkedI,"2021548434972721154");
|
|
}),
|
|
);
|
|
}
|
|
});
|
|
_tabController = TabController(length: _pages.length, vsync: this);
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Consumer<AppGeneralManager>(
|
|
builder: (context, ref, child) {
|
|
_tabs.clear();
|
|
ref.activityGiftByTab.keys.forEach((km) {
|
|
if (km == "2020752123128635394") {
|
|
_tabs.add(Tab(text: ATAppLocalizations.of(context)!.ramadan));
|
|
} else if (km == "1975233764843642882") {
|
|
_tabs.add(Tab(text: ATAppLocalizations.of(context)!.kingQuuen));
|
|
} else if (km == "2021548434972721154") {
|
|
_tabs.add(Tab(text: ATAppLocalizations.of(context)!.weekStart));
|
|
}
|
|
});
|
|
return Column(
|
|
children: [
|
|
Container(
|
|
height: 22.w,
|
|
child: Row(
|
|
children: [
|
|
SizedBox(width: 5.w),
|
|
Expanded(
|
|
child: TabBar(
|
|
tabAlignment: TabAlignment.start,
|
|
labelPadding: EdgeInsets.symmetric(horizontal: 8.w),
|
|
labelColor: Colors.white,
|
|
isScrollable: true,
|
|
indicator: BoxDecoration(),
|
|
indicatorWeight: 0,
|
|
unselectedLabelColor: Colors.white54,
|
|
labelStyle: TextStyle(
|
|
fontSize: 12.sp,
|
|
),
|
|
unselectedLabelStyle: TextStyle(
|
|
fontSize: 10.sp,
|
|
),
|
|
indicatorColor: Colors.transparent,
|
|
dividerColor: Colors.transparent,
|
|
controller: _tabController,
|
|
tabs: _tabs,
|
|
),
|
|
),
|
|
SizedBox(width: 5.w),
|
|
],
|
|
),) ,
|
|
Expanded(
|
|
child: TabBarView(
|
|
physics: NeverScrollableScrollPhysics(),
|
|
controller: _tabController,
|
|
children: _pages,
|
|
),
|
|
),
|
|
],
|
|
);
|
|
},
|
|
);
|
|
}
|
|
}
|