Skip to content

Commit

Permalink
Merge pull request #285 from GIfatahTH/dev
Browse files Browse the repository at this point in the history
update to dart 3 (issue #284 )
  • Loading branch information
GIfatahTH authored May 12, 2023
2 parents e9fed49 + 0807959 commit 5272503
Show file tree
Hide file tree
Showing 135 changed files with 395 additions and 226 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ class CounterViewModel {
// set the state mutably
_counter.setState((s) {
s[index] = CounterModel(s[index].value + 1);
return null;
});
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ class CounterViewModel {
// set the state mutably
_counter.setState((s) {
s[index] = CounterModel(s[index].value + 1);
return null;
});
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ enum WeatherCondition {
snowy,
unknown,
}

const defaultColor = Color(0xFF2196F3);

// Set primary color theme depending on the weather condition
Expand Down Expand Up @@ -84,6 +85,7 @@ class WeatherService {
),
);
}
return null;
},
);
Weather? get weather => weatherRM.state;
Expand Down
2 changes: 1 addition & 1 deletion examples/ex001_00_sync_global_and_local_state/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 1.0.0+1

environment:
sdk: ">=2.15.0 <3.0.0"
sdk: ">=2.15.0 <3.0.0"

# Dependencies specify other packages that your package needs in order to work.
# To automatically upgrade your package dependencies to the latest versions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ class CounterViewModel {
// if the next state will be the waiting or the error state,
// just return the current sate
if (!nextSnap.hasData) return currentSnap;
return null;
//
// This is the right place to do some state validation before mutation
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class SemBastLocalStorage {
}

Future<void> write<T>(String key, T value) async {
return store.record('key').put(db, value);
await store.record('key').put(db, value);
}

Future<T> read<T>(String key) async {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ class TodosViewModel {
}
// in all other cases set the _isWaitingForAddTodo to false
_isWaitingForAddTodo.state = false;
return null;
},
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ class TodosViewModel {
data: next.state.where((todo) => todo.id != todoToAdd.id).toList(),
);
}
return null;
},
);
}
Expand Down
2 changes: 1 addition & 1 deletion examples/ex004_00_navigation/lib/ex04_to_deeply_1.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ void main() {
runApp(const MyApp());
}

final navigator = RM.injectNavigator(
final InjectedNavigator navigator = RM.injectNavigator(
builder: (routerOutlet) {
return Builder(
builder: (context) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ final navigator = RM.injectNavigator(
if (location == '/page4') {
return data.redirectTo('/page5');
}
return null;
},
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ final navigator = RM.injectNavigator(
if (location == '/page4' && data.queryParams['q'] == 'NaN') {
return data.redirectTo('/redirect-page');
}
return null;
},
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ final navigator = RM.injectNavigator(
// Redirect the user to the home page
return data.redirectTo('/');
}
return null;
},
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ final navigator = RM.injectNavigator(
);
return false;
}
return null;
},
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ final navigator = RM.injectNavigator(
);
return false;
}
return null;
},
);

Expand Down
1 change: 1 addition & 0 deletions examples/ex004_00_navigation/lib/ex16_nested_route.dart
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ final navigator = RM.injectNavigator(
postponeToNextFrame: true,
);
}
return null;
},
);

Expand Down
1 change: 1 addition & 0 deletions examples/ex004_00_navigation/lib/ex18_books_app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ final navigator = RM.injectNavigator(
else if (signedIn && signingIn) {
return routeData.redirectTo('/books');
}
return null;
});

class App extends TopStatelessWidget {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import 'dart:math';

import 'package:ex_006_5_navigation/ex16_nested_route.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
Expand Down
Binary file modified examples/ex004_00_navigation/test/golden_files/ex04_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified examples/ex004_00_navigation/test/golden_files/ex04_10.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified examples/ex004_00_navigation/test/golden_files/ex04_11.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified examples/ex004_00_navigation/test/golden_files/ex04_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified examples/ex004_00_navigation/test/golden_files/ex04_3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified examples/ex004_00_navigation/test/golden_files/ex04_4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified examples/ex004_00_navigation/test/golden_files/ex04_5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified examples/ex004_00_navigation/test/golden_files/ex04_6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified examples/ex004_00_navigation/test/golden_files/ex04_7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified examples/ex004_00_navigation/test/golden_files/ex04_8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified examples/ex004_00_navigation/test/golden_files/ex04_9.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified examples/ex004_00_navigation/test/golden_files/ex05_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified examples/ex004_00_navigation/test/golden_files/ex05_10.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified examples/ex004_00_navigation/test/golden_files/ex05_11.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified examples/ex004_00_navigation/test/golden_files/ex05_12.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified examples/ex004_00_navigation/test/golden_files/ex05_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified examples/ex004_00_navigation/test/golden_files/ex05_3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified examples/ex004_00_navigation/test/golden_files/ex05_4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified examples/ex004_00_navigation/test/golden_files/ex05_5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified examples/ex004_00_navigation/test/golden_files/ex05_6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified examples/ex004_00_navigation/test/golden_files/ex05_7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified examples/ex004_00_navigation/test/golden_files/ex05_8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified examples/ex004_00_navigation/test/golden_files/ex05_9.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified examples/ex004_00_navigation/test/golden_files/ex10_10.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified examples/ex004_00_navigation/test/golden_files/ex10_11.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified examples/ex004_00_navigation/test/golden_files/ex10_2.png
Binary file modified examples/ex004_00_navigation/test/golden_files/ex10_3.png
Binary file modified examples/ex004_00_navigation/test/golden_files/ex10_4.png
Binary file modified examples/ex004_00_navigation/test/golden_files/ex10_5.png
Binary file modified examples/ex004_00_navigation/test/golden_files/ex10_6.png
Binary file modified examples/ex004_00_navigation/test/golden_files/ex10_7.png
Binary file modified examples/ex004_00_navigation/test/golden_files/ex10_8.png
Binary file modified examples/ex004_00_navigation/test/golden_files/ex10_9.png
Binary file modified examples/ex004_00_navigation/test/golden_files/ex11_1.png
Binary file modified examples/ex004_00_navigation/test/golden_files/ex11_2.png
Binary file modified examples/ex004_00_navigation/test/golden_files/ex11_3.png
Binary file modified examples/ex004_00_navigation/test/golden_files/ex11_4.png
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import 'package:uuid/uuid.dart';

import '../data_source/i_todos_repository.dart';
import '../data_source/todos_fake_repository.dart';
import '../data_source/todos_http_repository.dart';
import '../models/todo.dart';
import '../models/todo_filter.dart';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import 'dart:math';

import 'package:flutter/material.dart';
import 'package:states_rebuilder/states_rebuilder.dart';
import 'package:uuid/uuid.dart';

import '../data_source/i_todos_repository.dart';
import '../data_source/todos_fake_repository.dart';
import '../data_source/todos_http_repository.dart';
import '../models/todo.dart';
import '../models/todo_filter.dart';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import 'package:states_rebuilder/scr/state_management/rm.dart';
import 'blocs/auth_bloc.dart';
import 'ui/home_page/home_page.dart';
import 'ui/sign_in_page/sign_in_page.dart';
import 'ui/sign_in_register_form_page/sign_in_register_form_page.dart';

final navigator = RM.injectNavigator(
routes: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import 'package:states_rebuilder/scr/state_management/rm.dart';

import '../common/extensions.dart';
import '../data_source/fake_auth_repository.dart';
import '../data_source/firebase_auth_repository.dart';
import '../models/user.dart';

@immutable
Expand Down
2 changes: 1 addition & 1 deletion examples/ex007_00_app_theme_management/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ dependencies:
hive_flutter: ^1.0.0
states_rebuilder:
path: ../../states_rebuilder_package
google_fonts: ^2.3.1
google_fonts: any
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"helloWorld": "مرحبا بالجميع!",
"welcome": "مرحبا {name}",
"gender": "{gender, select, male {مرحبا يارجل!} female {مرحبا يامرأة!} other {مرحبا هناك!}}",
"plural": "{howMany, plural,=0{صفر رسالة} =1{رسالة واحدة} 2{رسالاتان} few{{howMany} رسائل} other{{howMany} رسالة}}",
"plural": "{howMany, plural,=0{صفر رسالة} =1{رسالة واحدة} =2{رسالاتان} few{{howMany} رسائل} other{{howMany} رسالة}}",
"formattedNumber": "الرقم بعد التهيئة هو {value}",
"date": "اليوم هو {date}"
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"welcome": "Welcome {name}",
"@welcome": {
"placeholders": {
"name": {}
"name": {}
}
},
"gender": "{gender, select, male {Hi man!} female {Hi woman!} other {Hi there!}}",
Expand Down
4 changes: 2 additions & 2 deletions examples/ex008_00_app_i18n_i10n/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ dependencies:

# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.2
intl: ^0.17.0
cupertino_icons: any
intl: any

dev_dependencies:
flutter_test:
Expand Down
39 changes: 37 additions & 2 deletions examples/ex009_00_animation/.metadata
Original file line number Diff line number Diff line change
@@ -1,10 +1,45 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled and should not be manually edited.
# This file should be version controlled.

version:
revision: f4abaa0735eba4dfd8f33f73363911d63931fe03
revision: 90c64ed42ba53a52d18f0cb3b17666c8662ed2a0
channel: stable

project_type: app

# Tracks metadata for the flutter migrate command
migration:
platforms:
- platform: root
create_revision: 90c64ed42ba53a52d18f0cb3b17666c8662ed2a0
base_revision: 90c64ed42ba53a52d18f0cb3b17666c8662ed2a0
- platform: android
create_revision: 90c64ed42ba53a52d18f0cb3b17666c8662ed2a0
base_revision: 90c64ed42ba53a52d18f0cb3b17666c8662ed2a0
- platform: ios
create_revision: 90c64ed42ba53a52d18f0cb3b17666c8662ed2a0
base_revision: 90c64ed42ba53a52d18f0cb3b17666c8662ed2a0
- platform: linux
create_revision: 90c64ed42ba53a52d18f0cb3b17666c8662ed2a0
base_revision: 90c64ed42ba53a52d18f0cb3b17666c8662ed2a0
- platform: macos
create_revision: 90c64ed42ba53a52d18f0cb3b17666c8662ed2a0
base_revision: 90c64ed42ba53a52d18f0cb3b17666c8662ed2a0
- platform: web
create_revision: 90c64ed42ba53a52d18f0cb3b17666c8662ed2a0
base_revision: 90c64ed42ba53a52d18f0cb3b17666c8662ed2a0
- platform: windows
create_revision: 90c64ed42ba53a52d18f0cb3b17666c8662ed2a0
base_revision: 90c64ed42ba53a52d18f0cb3b17666c8662ed2a0

# User provided section

# List of Local paths (relative to this file) that should be
# ignored by the migrate tool.
#
# Files that are not part of the templates will be ignored by default.
unmanaged_files:
- 'lib/main.dart'
- 'ios/Runner.xcodeproj/project.pbxproj'
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ class _Body extends StatelessWidget {
static final form = RM.injectForm(
autovalidateMode: AutovalidateMode.onUserInteraction,
);
static final text = RM.injectTextEditing();
static final checkbox = RM.injectFormField(
// static final text = RM.injectTextEditing();
static final checkbox = RM.injectFormField<bool>(
false,
validators: [
(val) => !val ? 'You must accept terms and conditions to continue' : null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import 'package:flutter_test/flutter_test.dart';

void main() {
late Finder emailTextField;
late Finder passwordTextField;
late Finder activeLoginButton;
// late Finder passwordTextField;
// late Finder activeLoginButton;
setUp(
() {
emailTextField = find.byWidgetPredicate(
Expand All @@ -14,15 +14,15 @@ void main() {
widget.decoration?.labelText == "Email Address",
);

passwordTextField = find.byWidgetPredicate(
(widget) =>
widget is TextField && widget.decoration?.labelText == "Password",
);
// passwordTextField = find.byWidgetPredicate(
// (widget) =>
// widget is TextField && widget.decoration?.labelText == "Password",
// );

//active login button is that with a non null onPressed parameter
activeLoginButton = find.byWidgetPredicate(
(widget) => widget is ElevatedButton && widget.onPressed != null,
);
// //active login button is that with a non null onPressed parameter
// activeLoginButton = find.byWidgetPredicate(
// (widget) => widget is ElevatedButton && widget.onPressed != null,
// );
},
);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,30 +1,29 @@
import 'package:ex010_00_form_fields/ex_003_00_text_fields_validation_using_injectedForm.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';

void main() {
late Finder emailTextField;
late Finder passwordTextField;
late Finder activeLoginButton;
setUp(
() {
emailTextField = find.byWidgetPredicate(
(widget) =>
widget is TextField &&
widget.decoration?.labelText == "Email Address",
);
// late Finder emailTextField;
// late Finder passwordTextField;
// late Finder activeLoginButton;
// setUp(
// () {
// emailTextField = find.byWidgetPredicate(
// (widget) =>
// widget is TextField &&
// widget.decoration?.labelText == "Email Address",
// );

passwordTextField = find.byWidgetPredicate(
(widget) =>
widget is TextField && widget.decoration?.labelText == "Password",
);
// passwordTextField = find.byWidgetPredicate(
// (widget) =>
// widget is TextField && widget.decoration?.labelText == "Password",
// );

//active login button is that with a non null onPressed parameter
activeLoginButton = find.byWidgetPredicate(
(widget) => widget is ElevatedButton && widget.onPressed != null,
);
},
);
// //active login button is that with a non null onPressed parameter
// activeLoginButton = find.byWidgetPredicate(
// (widget) => widget is ElevatedButton && widget.onPressed != null,
// );
// },
// );

testWidgets('email validation', (WidgetTester tester) async {
// Build our app and trigger a frame.
Expand Down
Loading

0 comments on commit 5272503

Please sign in to comment.