добавил немного красоты в 6 лабу
This commit is contained in:
parent
604a39379e
commit
c8115b9eca
@ -78,21 +78,9 @@ class _BodyState extends State<_Body> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Padding(
|
return Center(
|
||||||
padding: EdgeInsets.only(top: MediaQuery.of(context).padding.top),
|
child: Stack(
|
||||||
child: Column(
|
|
||||||
children: [
|
children: [
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.all(12),
|
|
||||||
child: CupertinoSearchTextField(
|
|
||||||
controller: searchController,
|
|
||||||
onChanged: (search) {
|
|
||||||
Debounce.run(() => context
|
|
||||||
.read<HomeBloc>()
|
|
||||||
.add(HomeLoadDataEvent(search: search)));
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
BlocBuilder<HomeBloc, HomeState>(
|
BlocBuilder<HomeBloc, HomeState>(
|
||||||
builder: (context, state) => state.error != null
|
builder: (context, state) => state.error != null
|
||||||
? Text(
|
? Text(
|
||||||
@ -103,7 +91,7 @@ class _BodyState extends State<_Body> {
|
|||||||
?.copyWith(color: Colors.red),
|
?.copyWith(color: Colors.red),
|
||||||
)
|
)
|
||||||
: state.isLoading
|
: state.isLoading
|
||||||
? const CircularProgressIndicator()
|
? Center(child: CircularProgressIndicator())
|
||||||
: Expanded(
|
: Expanded(
|
||||||
child: RefreshIndicator(
|
child: RefreshIndicator(
|
||||||
onRefresh: _onRefresh,
|
onRefresh: _onRefresh,
|
||||||
@ -114,11 +102,17 @@ class _BodyState extends State<_Body> {
|
|||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.all(12),
|
padding: const EdgeInsets.only(
|
||||||
child: CupertinoSearchTextField(),
|
left: 8.0, right: 8),
|
||||||
);
|
child: CupertinoSearchTextField(
|
||||||
|
borderRadius: BorderRadius.only(
|
||||||
|
bottomLeft: Radius.circular(20),
|
||||||
|
bottomRight: Radius.circular(20),
|
||||||
|
),
|
||||||
|
backgroundColor: Colors.amberAccent,
|
||||||
|
));
|
||||||
}
|
}
|
||||||
final data = state.data?.data?[index-1];
|
final data = state.data?.data?[index - 1];
|
||||||
return data != null
|
return data != null
|
||||||
? _Card.fromData(
|
? _Card.fromData(
|
||||||
data,
|
data,
|
||||||
@ -132,11 +126,37 @@ class _BodyState extends State<_Body> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
BlocBuilder<HomeBloc, HomeState>(
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 8.0, right: 8),
|
||||||
|
child: CupertinoSearchTextField(
|
||||||
|
borderRadius: BorderRadius.only(
|
||||||
|
bottomLeft: Radius.circular(20),
|
||||||
|
bottomRight: Radius.circular(20),
|
||||||
|
),
|
||||||
|
backgroundColor: Colors.amberAccent,
|
||||||
|
controller: searchController,
|
||||||
|
onChanged: (search) {
|
||||||
|
Debounce.run(() => context
|
||||||
|
.read<HomeBloc>()
|
||||||
|
.add(HomeLoadDataEvent(search: search)));
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Align(
|
||||||
|
alignment: Alignment.bottomCenter,
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: SizedBox(
|
||||||
|
height: 50,
|
||||||
|
width: 50,
|
||||||
|
child: BlocBuilder<HomeBloc, HomeState>(
|
||||||
builder: (context, state) => state.isPaginationLoading
|
builder: (context, state) => state.isPaginationLoading
|
||||||
? const CircularProgressIndicator()
|
? const CircularProgressIndicator()
|
||||||
: const SizedBox.shrink(),
|
: const SizedBox.shrink(),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user