Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import 'package:flutter/material.dart';
- import 'package:flutter_bloc/flutter_bloc.dart';
- import 'package:google_fonts/google_fonts.dart';
- import 'package:module_category/presentation/bloc/category_filter_courier_bloc/category_filter_courier_bloc.dart';
- import 'package:module_core/common/state_enum.dart';
- import 'package:module_core/utils/app_colors.dart';
- class CategoryFilterCourierPage extends StatelessWidget {
- CategoryFilterCourierPage({Key? key}) : super(key: key);
- @override
- Widget build(BuildContext context) {
- Future.microtask(() =>
- BlocProvider.of<CategoryFilterCourierBloc>(context, listen: false)
- .add(OnClickFilterCourierDefault()));
- return Container(
- height: 475,
- child: SingleChildScrollView(
- child: Column(
- mainAxisSize: MainAxisSize.min,
- children: [
- Stack(
- alignment: Alignment.center,
- children: [
- Container(
- height: 4,
- width: 150,
- decoration: BoxDecoration(
- color: Colors.grey[400],
- borderRadius: BorderRadius.circular(4),
- ),
- ),
- Padding(
- padding: const EdgeInsets.only(right: 8.0, top: 8),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.end,
- children: [
- GestureDetector(
- onTap: () {
- Navigator.pop(context);
- },
- child: Icon(
- Icons.close,
- color: Color(0xffAEAFB2),
- size: 24,
- ),
- ),
- ],
- ),
- ),
- ],
- ),
- SizedBox(height: 16),
- Text(
- 'Pengiriman',
- textAlign: TextAlign.center,
- style: GoogleFonts.poppins(
- fontSize: 16,
- fontWeight: FontWeight.w600,
- ),
- ),
- Container(
- margin: EdgeInsets.symmetric(vertical: 16),
- height: 1,
- width: MediaQuery.of(context).size.width,
- color: Color(0xffC4C4C4),
- ),
- Padding(
- padding:
- const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0),
- child: TextField(
- onChanged: (query) {
- context
- .read<CategoryFilterCourierBloc>()
- .add(OnChangeFilterCourierSearch(query));
- },
- decoration: InputDecoration(
- filled: true,
- fillColor: Color(0xffC6E4EC).withOpacity(0.5),
- hintText: 'Cari Lokasi...',
- labelStyle: TextStyle(
- fontFamily: GoogleFonts.poppins().fontFamily,
- color: Colors.grey[400],
- ),
- prefixIcon:
- Icon(Icons.search_sharp, color: AppColors.grueMedium),
- border: OutlineInputBorder(
- borderSide: BorderSide(
- color: Color(0xffC6E4EC).withOpacity(0.5)),
- borderRadius: BorderRadius.circular(24)),
- enabledBorder: OutlineInputBorder(
- borderSide: BorderSide(
- color: Color(0xffC6E4EC).withOpacity(0.5)),
- borderRadius: BorderRadius.circular(24)),
- focusedBorder: OutlineInputBorder(
- borderSide: BorderSide(
- color: Color(0xffC6E4EC).withOpacity(0.5)),
- borderRadius: BorderRadius.circular(24)),
- contentPadding: EdgeInsets.all(12)),
- textInputAction: TextInputAction.search,
- ),
- ),
- BlocBuilder<CategoryFilterCourierBloc, CategoryFilterCourierState>(
- builder: (context, state) {
- if (state.state == RequestState.Loading) {
- return Center(
- child: CircularProgressIndicator(),
- );
- } else if (state.state == RequestState.Loaded) {
- return Container(
- margin: EdgeInsets.symmetric(horizontal: 16, vertical: 14),
- height: 325,
- child: ListView.builder(
- itemCount: state.data?.response.data.length ?? 0,
- itemBuilder: (context, index) {
- return Container(
- margin: EdgeInsets.symmetric(vertical: 8),
- child: Column(
- children: [
- Row(
- children: [
- Text(
- state.data?.response.data[index].courier ??
- 'Courirer Name',
- style: GoogleFonts.roboto(
- fontSize: 12,
- fontWeight: FontWeight.w400),
- ),
- ],
- ),
- SizedBox(height: 12),
- Container(
- height: 1,
- color: Color(0xffC4C4C4),
- ),
- ],
- ));
- },
- ),
- );
- } else if (state.state == RequestState.Empty) {
- return Center(
- child: Text('Data Kosong'),
- );
- } else if (state.state == RequestState.Error) {
- return Center(
- child: Text('Error'),
- );
- } else {
- return Container();
- }
- })
- ],
- ),
- ),
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement