Skip to content

Commit

Permalink
✨ 読み込みが失敗した時にrefreshボタンを表示するようなコンポーネントの作成
Browse files Browse the repository at this point in the history
  • Loading branch information
Aosanori committed May 21, 2024
1 parent e63a945 commit ecf3d4d
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions packages/cores/core/lib/src/ui/util/common_paging_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -180,3 +180,48 @@ class _LoadingItem extends StatelessWidget {
Widget build(BuildContext context) =>
const Center(child: CircularProgressIndicator());
}

class _EndItemWhenError extends StatelessWidget {
const _EndItemWhenError({required void Function() onPressed})
: _onPressed = onPressed;
final void Function() _onPressed;

@override
Widget build(BuildContext context) {
return SizedBox(
height: 130,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
const Flexible(
flex: 3,
child: Center(
child: Icon(Icons.cloud_off),
),
),
const Flexible(
flex: 2,
child: Center(
child: Text(
'Please check your connection and try again.',
),
),
),
Flexible(
flex: 3,
child: Center(
child: // ElevatedButton(
ElevatedButton(
style: ElevatedButton.styleFrom(
shape: const StadiumBorder(),
),
onPressed: _onPressed,
child: const Text('refresh'),
),
),
),
],
),
);
}
}

0 comments on commit ecf3d4d

Please sign in to comment.