Work about PagedList history with infinite scroll
This commit is contained in:
parent
1c26298a16
commit
5c4a029674
Binary file not shown.
After Width: | Height: | Size: 45 KiB |
Binary file not shown.
After Width: | Height: | Size: 16 KiB |
Binary file not shown.
After Width: | Height: | Size: 18 KiB |
Binary file not shown.
Before Width: | Height: | Size: 2.2 KiB |
Binary file not shown.
Before Width: | Height: | Size: 5.7 KiB |
|
@ -0,0 +1 @@
|
||||||
|
|
|
@ -11,6 +11,8 @@ import 'package:intl/intl.dart';
|
||||||
import 'api.dart';
|
import 'api.dart';
|
||||||
import "package:dio/dio.dart";
|
import "package:dio/dio.dart";
|
||||||
|
|
||||||
|
List<String> litems = ["1", "2", "Third", "4"];
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
runApp(MyApp());
|
runApp(MyApp());
|
||||||
}
|
}
|
||||||
|
@ -96,7 +98,9 @@ class _MyAppState extends State<MyApp> {
|
||||||
),
|
),
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 30.0, color: Colors.black)),
|
fontSize: 30.0, color: Colors.black)),
|
||||||
|
|
||||||
TextField(
|
TextField(
|
||||||
|
|
||||||
// Affichage history
|
// Affichage history
|
||||||
enabled: false,
|
enabled: false,
|
||||||
controller: this._outputHistory,
|
controller: this._outputHistory,
|
||||||
|
@ -137,6 +141,11 @@ class _MyAppState extends State<MyApp> {
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
// new ListView.builder(
|
||||||
|
// itemCount: litems.length,
|
||||||
|
// itemBuilder: (BuildContext ctxt, int index) {
|
||||||
|
// return new Text(litems[index]);
|
||||||
|
// })
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
@ -270,4 +279,5 @@ class _MyAppState extends State<MyApp> {
|
||||||
// print("Veuillez renseigner une clé publique");
|
// print("Veuillez renseigner une clé publique");
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
// import 'package:readwenderlich/ui/exception_indicators/exception_indicator.dart';
|
||||||
|
|
||||||
|
/// Indicates that no items were found.
|
||||||
|
class EmptyListIndicator extends StatelessWidget {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) => const ExceptionIndicator(
|
||||||
|
title: 'Too much filtering',
|
||||||
|
message: 'We couldn\'t find any results matching your applied filters.',
|
||||||
|
assetName: 'assets/empty-box.png',
|
||||||
|
);
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
import 'dart:io';
|
||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
// import 'package:readwenderlich/ui/exception_indicators/generic_error_indicator.dart';
|
||||||
|
// import 'package:readwenderlich/ui/exception_indicators/no_connection_indicator.dart';
|
||||||
|
|
||||||
|
/// Based on the received error, displays either a [NoConnectionIndicator] or
|
||||||
|
/// a [GenericErrorIndicator].
|
||||||
|
class ErrorIndicator extends StatelessWidget {
|
||||||
|
const ErrorIndicator({
|
||||||
|
@required this.error,
|
||||||
|
this.onTryAgain,
|
||||||
|
Key key,
|
||||||
|
}) : assert(error != null),
|
||||||
|
super(key: key);
|
||||||
|
|
||||||
|
final dynamic error;
|
||||||
|
final VoidCallback onTryAgain;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) => error is SocketException
|
||||||
|
? NoConnectionIndicator(
|
||||||
|
onTryAgain: onTryAgain,
|
||||||
|
)
|
||||||
|
: GenericErrorIndicator(
|
||||||
|
onTryAgain: onTryAgain,
|
||||||
|
);
|
||||||
|
}
|
|
@ -0,0 +1,70 @@
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
/// Basic layout for indicating that an exception occurred.
|
||||||
|
class ExceptionIndicator extends StatelessWidget {
|
||||||
|
const ExceptionIndicator({
|
||||||
|
@required this.title,
|
||||||
|
@required this.assetName,
|
||||||
|
this.message,
|
||||||
|
this.onTryAgain,
|
||||||
|
Key key,
|
||||||
|
}) : assert(title != null),
|
||||||
|
assert(assetName != null),
|
||||||
|
super(key: key);
|
||||||
|
final String title;
|
||||||
|
final String message;
|
||||||
|
final String assetName;
|
||||||
|
final VoidCallback onTryAgain;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) => Center(
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: 32, horizontal: 16),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Image.asset(
|
||||||
|
assetName,
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 32,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
title,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: Theme.of(context).textTheme.headline6,
|
||||||
|
),
|
||||||
|
if (message != null)
|
||||||
|
const SizedBox(
|
||||||
|
height: 16,
|
||||||
|
),
|
||||||
|
if (message != null)
|
||||||
|
Text(
|
||||||
|
message,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
if (onTryAgain != null) const Spacer(),
|
||||||
|
if (onTryAgain != null)
|
||||||
|
SizedBox(
|
||||||
|
height: 50,
|
||||||
|
width: double.infinity,
|
||||||
|
child: RaisedButton.icon(
|
||||||
|
onPressed: onTryAgain,
|
||||||
|
icon: const Icon(
|
||||||
|
Icons.refresh,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
label: const Text(
|
||||||
|
'Try Again',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 16,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
// import 'package:readwenderlich/ui/exception_indicators/exception_indicator.dart';
|
||||||
|
|
||||||
|
/// Indicates that an unknown error occurred.
|
||||||
|
class GenericErrorIndicator extends StatelessWidget {
|
||||||
|
const GenericErrorIndicator({
|
||||||
|
Key key,
|
||||||
|
this.onTryAgain,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
|
final VoidCallback onTryAgain;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) => ExceptionIndicator(
|
||||||
|
title: 'Something went wrong',
|
||||||
|
message: 'The application has encountered an unknown error.\n'
|
||||||
|
'Please try again later.',
|
||||||
|
assetName: 'assets/confused-face.png',
|
||||||
|
onTryAgain: onTryAgain,
|
||||||
|
);
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
// import 'package:readwenderlich/ui/exception_indicators/exception_indicator.dart';
|
||||||
|
|
||||||
|
/// Indicates that a connection error occurred.
|
||||||
|
class NoConnectionIndicator extends StatelessWidget {
|
||||||
|
const NoConnectionIndicator({
|
||||||
|
Key key,
|
||||||
|
this.onTryAgain,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
|
final VoidCallback onTryAgain;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) => ExceptionIndicator(
|
||||||
|
title: 'No connection',
|
||||||
|
message: 'Please check internet connection and try again.',
|
||||||
|
assetName: 'assets/frustrated-face.png',
|
||||||
|
onTryAgain: onTryAgain,
|
||||||
|
);
|
||||||
|
}
|
|
@ -0,0 +1 @@
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
|
16
pubspec.lock
16
pubspec.lock
|
@ -179,6 +179,13 @@ packages:
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.1.1"
|
version: "1.1.1"
|
||||||
|
infinite_scroll_pagination:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: infinite_scroll_pagination
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "2.2.3"
|
||||||
intl:
|
intl:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
@ -254,6 +261,13 @@ packages:
|
||||||
description: flutter
|
description: flutter
|
||||||
source: sdk
|
source: sdk
|
||||||
version: "0.0.99"
|
version: "0.0.99"
|
||||||
|
sliver_tools:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: sliver_tools
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "0.1.10+1"
|
||||||
source_span:
|
source_span:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -326,4 +340,4 @@ packages:
|
||||||
version: "2.2.1"
|
version: "2.2.1"
|
||||||
sdks:
|
sdks:
|
||||||
dart: ">=2.10.0-110 <2.11.0"
|
dart: ">=2.10.0-110 <2.11.0"
|
||||||
flutter: ">=1.12.13+hotfix.5 <2.0.0"
|
flutter: ">=1.22.0 <2.0.0"
|
||||||
|
|
|
@ -33,11 +33,13 @@ dependencies:
|
||||||
gql_link:
|
gql_link:
|
||||||
intl:
|
intl:
|
||||||
flutter_launcher_icons: "^0.8.0"
|
flutter_launcher_icons: "^0.8.0"
|
||||||
|
infinite_scroll_pagination: ^2.2.3
|
||||||
|
|
||||||
|
|
||||||
flutter_icons:
|
flutter_icons:
|
||||||
android: "launcher_icon"
|
android: "launcher_icon"
|
||||||
ios: true
|
ios: true
|
||||||
image_path: "assets/icon/gecko-bb-36.png"
|
image_path: "assets/icon/gecko5b96.png"
|
||||||
|
|
||||||
# The following adds the Cupertino Icons font to your application.
|
# The following adds the Cupertino Icons font to your application.
|
||||||
# Use with the CupertinoIcons class for iOS style icons.
|
# Use with the CupertinoIcons class for iOS style icons.
|
||||||
|
|
Loading…
Reference in New Issue