refactor: убрал закоментированный код

This commit is contained in:
Никита Потапов 2024-12-21 14:35:04 +04:00
parent c087b6a2a2
commit 8132957bf2

View File

@ -81,7 +81,10 @@ class _BodyState extends State<_Body> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Padding( return Padding(
padding: EdgeInsets.only(top: MediaQuery.of(context).padding.top), padding: EdgeInsets.only(top: MediaQuery
.of(context)
.padding
.top),
child: Column( child: Column(
children: [ children: [
Row( Row(
@ -94,7 +97,8 @@ class _BodyState extends State<_Body> {
controller: searchController, controller: searchController,
placeholder: context.locale.search, placeholder: context.locale.search,
onChanged: (search) { onChanged: (search) {
Debounce.run(() => context Debounce.run(() =>
context
.read<HomeBloc>() .read<HomeBloc>()
.add(HomeLoadDataEvent(search: search))); .add(HomeLoadDataEvent(search: search)));
}, },
@ -121,10 +125,12 @@ class _BodyState extends State<_Body> {
], ],
), ),
BlocBuilder<HomeBloc, HomeState>( BlocBuilder<HomeBloc, HomeState>(
builder: (context, state) => state.error != null builder: (context, state) =>
state.error != null
? Text( ? Text(
state.error ?? '', state.error ?? '',
style: Theme.of(context) style: Theme
.of(context)
.textTheme .textTheme
.headlineSmall .headlineSmall
?.copyWith(color: Colors.red), ?.copyWith(color: Colors.red),
@ -161,7 +167,8 @@ class _BodyState extends State<_Body> {
), ),
), ),
BlocBuilder<HomeBloc, HomeState>( BlocBuilder<HomeBloc, HomeState>(
builder: (context, state) => state.isPaginationLoading builder: (context, state) =>
state.isPaginationLoading
? const CircularProgressIndicator() ? const CircularProgressIndicator()
: const SizedBox.shrink(), : const SizedBox.shrink(),
), ),
@ -205,27 +212,3 @@ class _BodyState extends State<_Body> {
}); });
} }
} }
//
// @override
// Widget build(BuildContext context) {
// final data = ApiRepository().loadData();
// return Center(
// child: FutureBuilder<List<CardData>?>(
// future: data,
// builder: (context, snapshot) => SingleChildScrollView(
// child: snapshot.hasData
// ? Column(
// mainAxisAlignment: MainAxisAlignment.center,
// children: snapshot.data
// ?.map((data) => CardPost.fromData(data,
// onLike: (String title, bool isLiked) =>
// _showSnackBar(context, title, isLiked),
// onTap: () => _navToDetails(context, data)))
// .toList() ??
// [])
// : const CircularProgressIndicator(),
// ),
// ),
// );
// }