Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc63094f

Browse files
committed
Create feature auto refresh after add and edit data
1 parentcbe83bb commitc63094f

File tree

5 files changed

+50
-56
lines changed

5 files changed

+50
-56
lines changed

‎ios/Runner.xcodeproj/project.pbxproj‎

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@
99
/* Begin PBXBuildFile section */
1010
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
1111
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
12-
3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; };
13-
3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
14-
9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; };
15-
9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
1612
9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; };
1713
978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; };
1814
97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; };
@@ -28,8 +24,6 @@
2824
dstPath = "";
2925
dstSubfolderSpec = 10;
3026
files = (
31-
3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */,
32-
9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */,
3327
);
3428
name = "Embed Frameworks";
3529
runOnlyForDeploymentPostprocessing = 0;
@@ -40,13 +34,11 @@
4034
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
4135
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
4236
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
43-
3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = "<group>"; };
4437
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
4538
7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
4639
7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
4740
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; };
4841
9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = "<group>"; };
49-
9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = "<group>"; };
5042
97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
5143
97C146F21CF9000F007C117D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
5244
97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
@@ -60,8 +52,6 @@
6052
isa = PBXFrameworksBuildPhase;
6153
buildActionMask = 2147483647;
6254
files = (
63-
9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */,
64-
3B80C3941E831B6300D905FE /* App.framework in Frameworks */,
6555
);
6656
runOnlyForDeploymentPostprocessing = 0;
6757
};
@@ -71,9 +61,7 @@
7161
9740EEB11CF90186004384FC /* Flutter */ = {
7262
isa = PBXGroup;
7363
children = (
74-
3B80C3931E831B6300D905FE /* App.framework */,
7564
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */,
76-
9740EEBA1CF902C7004384FC /* Flutter.framework */,
7765
9740EEB21CF90195004384FC /* Debug.xcconfig */,
7866
7AFA3C8E1D35360C0083082E /* Release.xcconfig */,
7967
9740EEB31CF90195004384FC /* Generated.xcconfig */,
@@ -206,7 +194,7 @@
206194
);
207195
runOnlyForDeploymentPostprocessing = 0;
208196
shellPath = /bin/sh;
209-
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\"thin";
197+
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\"embed_and_thin";
210198
};
211199
9740EEB61CF901F6004384FC /* Run Script */ = {
212200
isa = PBXShellScriptBuildPhase;
@@ -259,7 +247,6 @@
259247
/* Begin XCBuildConfiguration section */
260248
249021D3217E4FDB00AE95B9 /* Profile */ = {
261249
isa = XCBuildConfiguration;
262-
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
263250
buildSettings = {
264251
ALWAYS_SEARCH_USER_PATHS = NO;
265252
CLANG_ANALYZER_NONNULL = YES;
@@ -331,7 +318,6 @@
331318
};
332319
97C147031CF9000F007C117D /* Debug */ = {
333320
isa = XCBuildConfiguration;
334-
baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
335321
buildSettings = {
336322
ALWAYS_SEARCH_USER_PATHS = NO;
337323
CLANG_ANALYZER_NONNULL = YES;
@@ -385,7 +371,6 @@
385371
};
386372
97C147041CF9000F007C117D /* Release */ = {
387373
isa = XCBuildConfiguration;
388-
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
389374
buildSettings = {
390375
ALWAYS_SEARCH_USER_PATHS = NO;
391376
CLANG_ANALYZER_NONNULL = YES;

‎lib/src/app.dart‎

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@ import 'package:flutter_crud_api_sample_app/src/ui/home/home_screen.dart';
44

55
GlobalKey<ScaffoldState> _scaffoldState=GlobalKey<ScaffoldState>();
66

7-
classAppextendsStatelessWidget {
7+
classAppextendsStatefulWidget {
8+
@override
9+
_AppStatecreateState()=>_AppState();
10+
}
11+
12+
class_AppStateextendsState<App> {
813
@override
914
Widgetbuild(BuildContext context) {
1015
returnMaterialApp(
@@ -23,13 +28,16 @@ class App extends StatelessWidget {
2328
),
2429
actions:<Widget>[
2530
GestureDetector(
26-
onTap: () {
27-
Navigator.push(
31+
onTap: ()async{
32+
var result=awaitNavigator.push(
2833
_scaffoldState.currentContext,
2934
MaterialPageRoute(builder: (BuildContext context) {
3035
returnFormAddScreen();
3136
}),
3237
);
38+
if (result!=null) {
39+
setState(() {});
40+
}
3341
},
3442
child:Padding(
3543
padding:constEdgeInsets.only(right:16.0),

‎lib/src/ui/formadd/form_add_screen.dart‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ class _FormAddScreenState extends State<FormAddScreen> {
9292
_apiService.createProfile(profile).then((isSuccess) {
9393
setState(()=> _isLoading=false);
9494
if (isSuccess) {
95-
Navigator.pop(_scaffoldState.currentState.context);
95+
Navigator.pop(_scaffoldState.currentState.context,true);
9696
}else {
9797
_scaffoldState.currentState.showSnackBar(SnackBar(
9898
content:Text("Submit data failed"),
@@ -104,7 +104,7 @@ class _FormAddScreenState extends State<FormAddScreen> {
104104
_apiService.updateProfile(profile).then((isSuccess) {
105105
setState(()=> _isLoading=false);
106106
if (isSuccess) {
107-
Navigator.pop(_scaffoldState.currentState.context);
107+
Navigator.pop(_scaffoldState.currentState.context,true);
108108
}else {
109109
_scaffoldState.currentState.showSnackBar(SnackBar(
110110
content:Text("Update data failed"),

‎lib/src/ui/home/home_screen.dart‎

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ class _HomeScreenState extends State<HomeScreen> {
2727
builder: (BuildContext context,AsyncSnapshot<List<Profile>> snapshot) {
2828
if (snapshot.hasError) {
2929
returnCenter(
30-
child:Text(
31-
"Something wrong with message: ${snapshot.error.toString()}"),
30+
child:Text("Something wrong with message: ${snapshot.error.toString()}"),
3231
);
3332
}elseif (snapshot.connectionState==ConnectionState.done) {
3433
List<Profile> profiles= snapshot.data;
@@ -73,27 +72,20 @@ class _HomeScreenState extends State<HomeScreen> {
7372
builder: (context) {
7473
returnAlertDialog(
7574
title:Text("Warning"),
76-
content:Text(
77-
"Are you sure want to delete data profile ${profile.name}?"),
75+
content:Text("Are you sure want to delete data profile ${profile.name}?"),
7876
actions:<Widget>[
7977
FlatButton(
8078
child:Text("Yes"),
8179
onPressed: () {
8280
Navigator.pop(context);
83-
apiService
84-
.deleteProfile(profile.id)
85-
.then((isSuccess) {
81+
apiService.deleteProfile(profile.id).then((isSuccess) {
8682
if (isSuccess) {
8783
setState(() {});
8884
Scaffold.of(this.context)
89-
.showSnackBar(SnackBar(
90-
content:Text(
91-
"Delete data success")));
85+
.showSnackBar(SnackBar(content:Text("Delete data success")));
9286
}else {
9387
Scaffold.of(this.context)
94-
.showSnackBar(SnackBar(
95-
content:Text(
96-
"Delete data failed")));
88+
.showSnackBar(SnackBar(content:Text("Delete data failed")));
9789
}
9890
});
9991
},
@@ -114,11 +106,13 @@ class _HomeScreenState extends State<HomeScreen> {
114106
),
115107
),
116108
FlatButton(
117-
onPressed: () {
118-
Navigator.push(context,
119-
MaterialPageRoute(builder: (context) {
109+
onPressed: ()async {
110+
var result=awaitNavigator.push(context,MaterialPageRoute(builder: (context) {
120111
returnFormAddScreen(profile: profile);
121112
}));
113+
if (result!=null) {
114+
setState(() {});
115+
}
122116
},
123117
child:Text(
124118
"Edit",

‎pubspec.lock‎

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,55 @@
11
# Generated by pub
2-
# See https://www.dartlang.org/tools/pub/glossary#lockfile
2+
# See https://dart.dev/tools/pub/glossary#lockfile
33
packages:
44
async:
55
dependency: transitive
66
description:
77
name: async
88
url: "https://pub.dartlang.org"
99
source: hosted
10-
version: "2.1.0"
10+
version: "2.4.1"
1111
boolean_selector:
1212
dependency: transitive
1313
description:
1414
name: boolean_selector
1515
url: "https://pub.dartlang.org"
1616
source: hosted
17-
version: "1.0.4"
17+
version: "2.0.0"
1818
charcode:
1919
dependency: transitive
2020
description:
2121
name: charcode
2222
url: "https://pub.dartlang.org"
2323
source: hosted
24-
version: "1.1.2"
24+
version: "1.1.3"
25+
clock:
26+
dependency: transitive
27+
description:
28+
name: clock
29+
url: "https://pub.dartlang.org"
30+
source: hosted
31+
version: "1.0.1"
2532
collection:
2633
dependency: transitive
2734
description:
2835
name: collection
2936
url: "https://pub.dartlang.org"
3037
source: hosted
31-
version: "1.14.11"
38+
version: "1.14.12"
3239
cupertino_icons:
3340
dependency: "direct main"
3441
description:
3542
name: cupertino_icons
3643
url: "https://pub.dartlang.org"
3744
source: hosted
3845
version: "0.1.2"
46+
fake_async:
47+
dependency: transitive
48+
description:
49+
name: fake_async
50+
url: "https://pub.dartlang.org"
51+
source: hosted
52+
version: "1.1.0"
3953
flutter:
4054
dependency: "direct main"
4155
description: flutter
@@ -66,35 +80,28 @@ packages:
6680
name: matcher
6781
url: "https://pub.dartlang.org"
6882
source: hosted
69-
version: "0.12.5"
83+
version: "0.12.6"
7084
meta:
7185
dependency: transitive
7286
description:
7387
name: meta
7488
url: "https://pub.dartlang.org"
7589
source: hosted
76-
version: "1.1.6"
90+
version: "1.1.8"
7791
path:
7892
dependency: transitive
7993
description:
8094
name: path
8195
url: "https://pub.dartlang.org"
8296
source: hosted
83-
version: "1.6.2"
97+
version: "1.7.0"
8498
pedantic:
8599
dependency: transitive
86100
description:
87101
name: pedantic
88102
url: "https://pub.dartlang.org"
89103
source: hosted
90104
version: "1.5.0"
91-
quiver:
92-
dependency: transitive
93-
description:
94-
name: quiver
95-
url: "https://pub.dartlang.org"
96-
source: hosted
97-
version: "2.0.2"
98105
sky_engine:
99106
dependency: transitive
100107
description: flutter
@@ -106,7 +113,7 @@ packages:
106113
name: source_span
107114
url: "https://pub.dartlang.org"
108115
source: hosted
109-
version: "1.5.5"
116+
version: "1.7.0"
110117
stack_trace:
111118
dependency: transitive
112119
description:
@@ -127,7 +134,7 @@ packages:
127134
name: string_scanner
128135
url: "https://pub.dartlang.org"
129136
source: hosted
130-
version: "1.0.4"
137+
version: "1.0.5"
131138
term_glyph:
132139
dependency: transitive
133140
description:
@@ -141,7 +148,7 @@ packages:
141148
name: test_api
142149
url: "https://pub.dartlang.org"
143150
source: hosted
144-
version: "0.2.4"
151+
version: "0.2.16"
145152
typed_data:
146153
dependency: transitive
147154
description:
@@ -157,4 +164,4 @@ packages:
157164
source: hosted
158165
version: "2.0.8"
159166
sdks:
160-
dart: ">=2.2.0 <3.0.0"
167+
dart: ">=2.7.0 <3.0.0"

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp