Added refresh button on error
This commit is contained in:
parent
0da3dfe9aa
commit
be48e955c7
9 changed files with 110 additions and 61 deletions
23
.gitignore
vendored
23
.gitignore
vendored
|
@ -25,10 +25,15 @@
|
||||||
.dart_tool/
|
.dart_tool/
|
||||||
.flutter-plugins
|
.flutter-plugins
|
||||||
.flutter-plugins-dependencies
|
.flutter-plugins-dependencies
|
||||||
|
**/generated_plugin_registrant.dart
|
||||||
.packages
|
.packages
|
||||||
.pub-cache/
|
.pub-cache/
|
||||||
.pub/
|
.pub/
|
||||||
/build/
|
build/
|
||||||
|
flutter_*.png
|
||||||
|
linked_*.ds
|
||||||
|
unlinked.ds
|
||||||
|
unlinked_spec.ds
|
||||||
|
|
||||||
# Android related
|
# Android related
|
||||||
**/android/**/gradle-wrapper.jar
|
**/android/**/gradle-wrapper.jar
|
||||||
|
@ -38,6 +43,8 @@
|
||||||
**/android/gradlew.bat
|
**/android/gradlew.bat
|
||||||
**/android/local.properties
|
**/android/local.properties
|
||||||
**/android/**/GeneratedPluginRegistrant.java
|
**/android/**/GeneratedPluginRegistrant.java
|
||||||
|
**/android/key.properties
|
||||||
|
*.jks
|
||||||
|
|
||||||
# iOS/XCode related
|
# iOS/XCode related
|
||||||
**/ios/**/*.mode1v3
|
**/ios/**/*.mode1v3
|
||||||
|
@ -56,18 +63,32 @@
|
||||||
**/ios/**/profile
|
**/ios/**/profile
|
||||||
**/ios/**/xcuserdata
|
**/ios/**/xcuserdata
|
||||||
**/ios/.generated/
|
**/ios/.generated/
|
||||||
|
**/ios/Flutter/.last_build_id
|
||||||
**/ios/Flutter/App.framework
|
**/ios/Flutter/App.framework
|
||||||
**/ios/Flutter/Flutter.framework
|
**/ios/Flutter/Flutter.framework
|
||||||
|
**/ios/Flutter/Flutter.podspec
|
||||||
**/ios/Flutter/Generated.xcconfig
|
**/ios/Flutter/Generated.xcconfig
|
||||||
|
**/ios/Flutter/ephemeral
|
||||||
**/ios/Flutter/app.flx
|
**/ios/Flutter/app.flx
|
||||||
**/ios/Flutter/app.zip
|
**/ios/Flutter/app.zip
|
||||||
**/ios/Flutter/flutter_assets/
|
**/ios/Flutter/flutter_assets/
|
||||||
|
**/ios/Flutter/flutter_export_environment.sh
|
||||||
**/ios/ServiceDefinitions.json
|
**/ios/ServiceDefinitions.json
|
||||||
**/ios/Runner/GeneratedPluginRegistrant.*
|
**/ios/Runner/GeneratedPluginRegistrant.*
|
||||||
|
|
||||||
|
# macOS
|
||||||
|
**/macos/Flutter/GeneratedPluginRegistrant.swift
|
||||||
|
|
||||||
|
# Coverage
|
||||||
|
coverage/
|
||||||
|
|
||||||
|
# Symbols
|
||||||
|
app.*.symbols
|
||||||
|
|
||||||
# Exceptions to above rules.
|
# Exceptions to above rules.
|
||||||
!**/ios/**/default.mode1v3
|
!**/ios/**/default.mode1v3
|
||||||
!**/ios/**/default.mode2v3
|
!**/ios/**/default.mode2v3
|
||||||
!**/ios/**/default.pbxuser
|
!**/ios/**/default.pbxuser
|
||||||
!**/ios/**/default.perspectivev3
|
!**/ios/**/default.perspectivev3
|
||||||
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
|
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
|
||||||
|
!/dev/ci/**/Gemfile.lock
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
v2.2.0
|
||||||
|
Added refresh button on error
|
||||||
|
|
||||||
v2.1.1
|
v2.1.1
|
||||||
Fixed Android build
|
Fixed Android build
|
||||||
Switched versioning format
|
Switched versioning format
|
||||||
|
|
|
@ -1,14 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
# This is a generated file; do not edit or check into version control.
|
|
||||||
export "FLUTTER_ROOT=/usr/local/Caskroom/flutter/2.2.3/flutter"
|
|
||||||
export "FLUTTER_APPLICATION_PATH=/Users/dan.cojocaru/info_tren"
|
|
||||||
export "COCOAPODS_PARALLEL_CODE_SIGN=true"
|
|
||||||
export "FLUTTER_TARGET=/Users/dan.cojocaru/info_tren/lib/main.dart"
|
|
||||||
export "FLUTTER_BUILD_DIR=build"
|
|
||||||
export "FLUTTER_BUILD_NAME=2.0.6"
|
|
||||||
export "FLUTTER_BUILD_NUMBER=2.0.6"
|
|
||||||
export "DART_DEFINES=Zmx1dHRlci5pbnNwZWN0b3Iuc3RydWN0dXJlZEVycm9ycz10cnVl,RkxVVFRFUl9XRUJfQVVUT19ERVRFQ1Q9dHJ1ZQ=="
|
|
||||||
export "DART_OBFUSCATION=false"
|
|
||||||
export "TRACK_WIDGET_CREATION=true"
|
|
||||||
export "TREE_SHAKE_ICONS=false"
|
|
||||||
export "PACKAGE_CONFIG=/Users/dan.cojocaru/info_tren/.dart_tool/package_config.json"
|
|
|
@ -46,7 +46,7 @@ class _RefreshFutureBuilderState<T> extends State<RefreshFutureBuilder<T>> {
|
||||||
case RefreshFutureBuilderState.waiting:
|
case RefreshFutureBuilderState.waiting:
|
||||||
return;
|
return;
|
||||||
case RefreshFutureBuilderState.error:
|
case RefreshFutureBuilderState.error:
|
||||||
snapshot = RefreshFutureBuilderSnapshot.refresh(null, snapshot.error, snapshot.stackTrace);
|
snapshot = RefreshFutureBuilderSnapshot.waiting();
|
||||||
break;
|
break;
|
||||||
case RefreshFutureBuilderState.done:
|
case RefreshFutureBuilderState.done:
|
||||||
snapshot = RefreshFutureBuilderSnapshot.refresh(snapshot.data);
|
snapshot = RefreshFutureBuilderSnapshot.refresh(snapshot.data);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:info_tren/components/cupertino_divider.dart';
|
||||||
import 'package:info_tren/components/select_train_suggestions/select_train_suggestions.dart';
|
import 'package:info_tren/components/select_train_suggestions/select_train_suggestions.dart';
|
||||||
import 'package:info_tren/models/train_operator_lines.dart';
|
import 'package:info_tren/models/train_operator_lines.dart';
|
||||||
|
|
||||||
|
@ -9,21 +9,19 @@ class SelectTrainSuggestionsStateCupertino extends SelectTrainSuggestionsState {
|
||||||
return Column(
|
return Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
GestureDetector(
|
Padding(
|
||||||
onTap: () {
|
padding: const EdgeInsets.all(0),
|
||||||
onTrainSelected(currentInput);
|
child: Column(
|
||||||
},
|
mainAxisSize: MainAxisSize.min,
|
||||||
child: Padding(
|
children: <Widget>[
|
||||||
padding: const EdgeInsets.all(8),
|
CupertinoButton(
|
||||||
child: Column(
|
child: Text(getUseCurrentInputWidgetText(currentInput)),
|
||||||
mainAxisSize: MainAxisSize.min,
|
onPressed: () => onTrainSelected(currentInput),
|
||||||
children: <Widget>[
|
),
|
||||||
Text(getUseCurrentInputWidgetText(currentInput)),
|
],
|
||||||
],
|
)
|
||||||
)
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
Divider(),
|
CupertinoDivider(),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -44,31 +42,37 @@ class OperatorAutocompleteTileCupertino extends OperatorAutocompleteTile {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return GestureDetector(
|
return Column(
|
||||||
onTap: () {
|
mainAxisSize: MainAxisSize.min,
|
||||||
onTrainSelected(train.internalNumber);
|
children: [
|
||||||
},
|
GestureDetector(
|
||||||
child: Padding(
|
onTap: () {
|
||||||
padding: const EdgeInsets.fromLTRB(16, 2, 16, 2),
|
onTrainSelected(train.internalNumber);
|
||||||
child: SizedBox(
|
},
|
||||||
width: double.infinity,
|
child: Padding(
|
||||||
child: Column(
|
padding: const EdgeInsets.fromLTRB(16, 4, 16, 4),
|
||||||
mainAxisSize: MainAxisSize.min,
|
child: SizedBox(
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
width: double.infinity,
|
||||||
children: <Widget>[
|
child: Column(
|
||||||
Text(
|
mainAxisSize: MainAxisSize.min,
|
||||||
operatorName,
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
style: CupertinoTheme.of(context).textTheme.textStyle.copyWith(fontSize: 10, fontWeight: FontWeight.w200),
|
children: <Widget>[
|
||||||
textAlign: TextAlign.left,
|
Text(
|
||||||
|
operatorName,
|
||||||
|
style: CupertinoTheme.of(context).textTheme.textStyle.copyWith(fontSize: 10, fontWeight: FontWeight.w200),
|
||||||
|
textAlign: TextAlign.left,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
"${train.rang} ${train.number}",
|
||||||
|
textAlign: TextAlign.left,
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
Text(
|
),
|
||||||
"${train.rang} ${train.number}",
|
|
||||||
textAlign: TextAlign.left,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
CupertinoDivider(),
|
||||||
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ class TrainInfo extends StatelessWidget {
|
||||||
return TrainInfoLoadingMaterial(title: trainNumber.toString(),);
|
return TrainInfoLoadingMaterial(title: trainNumber.toString(),);
|
||||||
}
|
}
|
||||||
else if (snapshot.state == RefreshFutureBuilderState.error) {
|
else if (snapshot.state == RefreshFutureBuilderState.error) {
|
||||||
return TrainInfoErrorMaterial(title: '$trainNumber - Error', error: snapshot.error!,);
|
return TrainInfoErrorMaterial(title: '$trainNumber - Error', error: snapshot.error!, refresh: refresh,);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TrainInfoMaterial(trainData: snapshot.data!,);
|
return TrainInfoMaterial(trainData: snapshot.data!,);
|
||||||
|
@ -42,7 +42,7 @@ class TrainInfo extends StatelessWidget {
|
||||||
return TrainInfoLoadingCupertino(title: trainNumber.toString(),);
|
return TrainInfoLoadingCupertino(title: trainNumber.toString(),);
|
||||||
}
|
}
|
||||||
else if (snapshot.state == RefreshFutureBuilderState.error) {
|
else if (snapshot.state == RefreshFutureBuilderState.error) {
|
||||||
return TrainInfoErrorCupertino(title: '$trainNumber - Error', error: snapshot.error!,);
|
return TrainInfoErrorCupertino(title: '$trainNumber - Error', error: snapshot.error!, refresh: refresh,);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TrainInfoCupertino(trainData: snapshot.data!,);
|
return TrainInfoCupertino(trainData: snapshot.data!,);
|
||||||
|
@ -64,6 +64,7 @@ abstract class TrainInfoLoading extends StatelessWidget {
|
||||||
abstract class TrainInfoError extends StatelessWidget {
|
abstract class TrainInfoError extends StatelessWidget {
|
||||||
final String title;
|
final String title;
|
||||||
final Object error;
|
final Object error;
|
||||||
|
final Future Function()? refresh;
|
||||||
|
|
||||||
TrainInfoError({required this.title, required this.error});
|
TrainInfoError({required this.title, required this.error, this.refresh});
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,11 @@ class TrainInfoLoadingCupertino extends TrainInfoLoading {
|
||||||
}
|
}
|
||||||
|
|
||||||
class TrainInfoErrorCupertino extends TrainInfoError {
|
class TrainInfoErrorCupertino extends TrainInfoError {
|
||||||
TrainInfoErrorCupertino({required Object error, required String title,}) : super(error: error, title: title,);
|
TrainInfoErrorCupertino({
|
||||||
|
required Object error,
|
||||||
|
required String title,
|
||||||
|
Future Function()? refresh,
|
||||||
|
}) : super(error: error, title: title, refresh: refresh,);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
@ -33,7 +37,20 @@ class TrainInfoErrorCupertino extends TrainInfoError {
|
||||||
middle: Text(title),
|
middle: Text(title),
|
||||||
),
|
),
|
||||||
child: Center(
|
child: Center(
|
||||||
child: Text(error.toString()),
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
Text(error.toString()),
|
||||||
|
if (refresh != null)
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(8),
|
||||||
|
child: CupertinoButton(
|
||||||
|
child: Text('Retry'),
|
||||||
|
onPressed: () => refresh!(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,11 @@ class TrainInfoLoadingMaterial extends TrainInfoLoading {
|
||||||
}
|
}
|
||||||
|
|
||||||
class TrainInfoErrorMaterial extends TrainInfoError {
|
class TrainInfoErrorMaterial extends TrainInfoError {
|
||||||
TrainInfoErrorMaterial({required Object error, required String title,}) : super(error: error, title: title,);
|
TrainInfoErrorMaterial({
|
||||||
|
required Object error,
|
||||||
|
required String title,
|
||||||
|
Future Function()? refresh,
|
||||||
|
}) : super(error: error, title: title, refresh: refresh,);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
@ -32,7 +36,20 @@ class TrainInfoErrorMaterial extends TrainInfoError {
|
||||||
title: Text(title),
|
title: Text(title),
|
||||||
),
|
),
|
||||||
body: Center(
|
body: Center(
|
||||||
child: Text(error.toString()),
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
Text(error.toString()),
|
||||||
|
if (refresh != null)
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(8),
|
||||||
|
child: ElevatedButton(
|
||||||
|
child: Text('Retry'),
|
||||||
|
onPressed: () => refresh!(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ description: O aplicație de vizualizare a datelor puse la dispoziție de Inform
|
||||||
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
|
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
|
||||||
# Read more about iOS versioning at
|
# Read more about iOS versioning at
|
||||||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
||||||
version: 2.1.1
|
version: 2.2.0
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=2.12.0 <3.0.0"
|
sdk: ">=2.12.0 <3.0.0"
|
||||||
|
|
Loading…
Add table
Reference in a new issue