99 lines
3.0 KiB
Dart
99 lines
3.0 KiB
Dart
import 'package:citycards_customer/common_packages/app_bar.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
import '../../common_packages/back_widget.dart';
|
|
import '../blocs/pass_bloc.dart';
|
|
import '../blocs/postcard_bloc.dart';
|
|
import 'my_pass_page_view.dart';
|
|
import 'my_postcard_page_view.dart';
|
|
|
|
|
|
class MyCartPage extends StatefulWidget {
|
|
const MyCartPage({super.key});
|
|
|
|
@override
|
|
State<MyCartPage> createState() => _MyCartPageState();
|
|
}
|
|
|
|
class _MyCartPageState extends State<MyCartPage> {
|
|
int selectedTab = 0;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return MultiBlocProvider(
|
|
providers: [
|
|
BlocProvider(create: (_) => PassBloc()..add(LoadPasses())),
|
|
BlocProvider(create: (_) => PostCardBloc()..add(LoadPostCards())),
|
|
],
|
|
child: Scaffold(
|
|
backgroundColor: Colors.white,
|
|
body: SafeArea(
|
|
child: SingleChildScrollView(
|
|
padding: EdgeInsets.all(16),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
CommonAppBar(isWhiteLogo: false, isProfilePage: false, showCart: false,),
|
|
backWidget(context, "Your Cart", Colors.black),
|
|
SizedBox(
|
|
height: 24.h,
|
|
),
|
|
Container(
|
|
padding: EdgeInsets.all(4.0),
|
|
margin: const EdgeInsets.all(16),
|
|
decoration: BoxDecoration(
|
|
color: const Color(0xffFEE7E7),
|
|
borderRadius: BorderRadius.circular(30),
|
|
),
|
|
child: Row(
|
|
children: [
|
|
_tabButton("My Passes", 0),
|
|
_tabButton("My Post Cards", 1),
|
|
],
|
|
),
|
|
),
|
|
Row(
|
|
children: [
|
|
Expanded(
|
|
child: selectedTab == 0
|
|
? const MyPassesPage()
|
|
: const MyPostCardsPage(),
|
|
)
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
Expanded _tabButton(String title, int index) {
|
|
final bool isSelected = selectedTab == index;
|
|
return Expanded(
|
|
child: GestureDetector(
|
|
onTap: () => setState(() => selectedTab = index),
|
|
child: Container(
|
|
padding: const EdgeInsets.symmetric(vertical: 12),
|
|
decoration: BoxDecoration(
|
|
color: isSelected ? Colors.white : Colors.transparent,
|
|
borderRadius: BorderRadius.circular(30),
|
|
),
|
|
child: Center(
|
|
child: Text(
|
|
title,
|
|
style: TextStyle(
|
|
fontWeight: FontWeight.w400,
|
|
color: Color(0xff2A2A2A),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|