You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
94 lines
2.8 KiB
Dart
94 lines
2.8 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:mc_common_app/config/routes.dart';
|
|
import 'package:mc_common_app/extensions/int_extensions.dart';
|
|
import 'package:mc_common_app/theme/colors.dart';
|
|
import 'package:mc_common_app/utils/navigator.dart';
|
|
import 'package:mc_common_app/widgets/button/show_fill_button.dart';
|
|
import 'package:mc_common_app/widgets/common_widgets/ads_list.dart';
|
|
|
|
class AdsFragment extends StatefulWidget {
|
|
AdsFragment({Key? key}) : super(key: key);
|
|
|
|
@override
|
|
State<AdsFragment> createState() => _AdsFragmentState();
|
|
}
|
|
|
|
class _AdsFragmentState extends State<AdsFragment> {
|
|
bool isExploreAdsTapped = true;
|
|
|
|
bool isMyAdsTapped = false;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
body: Container(
|
|
color: MyColors.backgroundColor,
|
|
width: double.infinity,
|
|
height: double.infinity,
|
|
child: Column(
|
|
children: [
|
|
16.height,
|
|
Row(
|
|
children: [
|
|
Expanded(
|
|
child: ShowFillButton(
|
|
isFilled: isExploreAdsTapped,
|
|
maxHeight: 55,
|
|
title: "Explore Ads",
|
|
txtColor: isExploreAdsTapped ? MyColors.white : MyColors.darkTextColor,
|
|
onPressed: () {
|
|
if (!isExploreAdsTapped) {
|
|
isExploreAdsTapped = true;
|
|
isMyAdsTapped = false;
|
|
}
|
|
setState(() {});
|
|
},
|
|
),
|
|
),
|
|
12.width,
|
|
Expanded(
|
|
child: ShowFillButton(
|
|
isFilled: isMyAdsTapped,
|
|
txtColor: isMyAdsTapped ? MyColors.white : MyColors.darkTextColor,
|
|
maxHeight: 55,
|
|
title: "My Ads",
|
|
onPressed: () {
|
|
if (!isMyAdsTapped) {
|
|
isMyAdsTapped = true;
|
|
isExploreAdsTapped = false;
|
|
}
|
|
setState(() {});
|
|
},
|
|
),
|
|
),
|
|
],
|
|
),
|
|
24.height,
|
|
Expanded(
|
|
child: BuildAdsList(
|
|
count: 20,
|
|
onAdPressed: () {
|
|
navigateWithName(
|
|
context,
|
|
AppRoutes.adsDetailView,
|
|
);
|
|
},
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
floatingActionButton: FloatingActionButton(
|
|
onPressed: () {
|
|
navigateWithName(context, AppRoutes.createAdView);
|
|
},
|
|
backgroundColor: MyColors.darkPrimaryColor,
|
|
child: Icon(
|
|
Icons.add,
|
|
color: MyColors.white,
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|