Compare commits

...

15 Commits

Author SHA1 Message Date
dependabot[bot] 980c32c8b7 Bump shared_preferences from 2.5.4 to 2.5.5
Bumps [shared_preferences](https://github.com/flutter/packages/tree/main/packages/shared_preferences) from 2.5.4 to 2.5.5.
- [Commits](https://github.com/flutter/packages/commits/shared_preferences-v2.5.5/packages/shared_preferences)

---
updated-dependencies:
- dependency-name: shared_preferences
  dependency-version: 2.5.5
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-26 04:11:13 +00:00
Rody Davis e2a470abfe Merge pull request #16 from bedranfleck/patch-1
Update Submodules / update-submodules (push) Failing after 21s
2026-03-12 07:48:28 -07:00
André Felipe Fleck Bedran 1164b50cc2 Refactor isDevice check to computed property
Refactor isDevice property to use computed property and better simulator detection API.
2026-02-23 19:45:47 -03:00
rodydavis ee78f04d33 update versions 2026-02-16 10:48:25 -08:00
rodydavis 3f8c930d48 update packages 2026-02-16 10:45:05 -08:00
Rody Davis 6d3ff3dcd5 Merge pull request #8 from rodydavis/dependabot/pub/pigeon-26.1.7
Bump pigeon from 26.1.5 to 26.1.7
2026-02-16 10:42:05 -08:00
Rody Davis 289b3dd4fa Merge pull request #14 from JoseAlba/mediaquery_breakpoints
Updated breakpoints package to using MediaQuery.sizeOf(context);
2026-02-16 10:40:59 -08:00
Rody Davis 5d2fb37973 Merge pull request #15 from rodydavis/dependabot/pub/test-1.29.0
Bump test from 1.26.3 to 1.29.0
2026-02-16 10:39:53 -08:00
github-actions[bot] 29116fa919 docs: update README [skip ci] 2026-02-16 18:36:41 +00:00
Rody Davis 36cb839dd8 Merge pull request #11 from kattaliraees/swift-build-error-fix 2026-02-16 10:36:13 -08:00
dependabot[bot] a6f4b4aed6 Bump test from 1.26.3 to 1.29.0
Bumps [test](https://github.com/dart-lang/test/tree/master/pkgs) from 1.26.3 to 1.29.0.
- [Release notes](https://github.com/dart-lang/test/releases)
- [Commits](https://github.com/dart-lang/test/commits/test-v1.29.0/pkgs)

---
updated-dependencies:
- dependency-name: test
  dependency-version: 1.29.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-02-16 04:21:43 +00:00
josealba 21224bffcf Breakpoints 2026-02-13 12:16:18 -05:00
Raees Kattali ab8d57c400 swift build error fix 2026-02-05 10:22:18 +03:00
dependabot[bot] 2debeaa79d Bump pigeon from 26.1.5 to 26.1.7
Bumps [pigeon](https://github.com/flutter/packages/tree/main/packages) from 26.1.5 to 26.1.7.
- [Commits](https://github.com/flutter/packages/commits/pigeon-v26.1.7/packages)

---
updated-dependencies:
- dependency-name: pigeon
  dependency-version: 26.1.7
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-01-23 04:14:21 +00:00
rodydavis 7d6028eb6d ignore deprecated packages 2026-01-21 00:42:50 -08:00
18 changed files with 232 additions and 390 deletions
+1
View File
@@ -26,6 +26,7 @@ A collection of Flutter packages maintained by @rodydavis.
| Package | Description | Version |
| :--- | :--- | :--- |
| [diff_algorithims](./experimental/diff_algorithims) | A set of diffing algorithims for Dart | ![Unpublished](https://img.shields.io/badge/pub-unpublished-inactive) |
| [http_get_cache](./experimental/http_get_cache) | HTTP Compliant cache for Flutter | ![Unpublished](https://img.shields.io/badge/pub-unpublished-inactive) |
| [pocketbase_auth](./experimental/pocketbase_auth) | Pocketbase auth client with built in UI screens and token refresh | ![Unpublished](https://img.shields.io/badge/pub-unpublished-inactive) |
| [pocketbase_sync](./experimental/pocketbase_sync) | A Flutter package for offline-first syncing with PocketBase. | ![Unpublished](https://img.shields.io/badge/pub-unpublished-inactive) |
| [web_file_system](./experimental/web_file_system) | A high-performance, asynchronous file system for the web using IDB and OPFS. | ![Unpublished](https://img.shields.io/badge/pub-unpublished-inactive) |
+4
View File
@@ -0,0 +1,4 @@
include: package:flutter_lints/flutter.yaml
analyzer:
exclude:
- deprecated/**
View File
+1 -1
View File
@@ -24,5 +24,5 @@ flutter:
macos:
pluginClass: AppReviewPlugin
dev_dependencies:
pigeon: ^26.1.5
pigeon: ^26.1.7
+4
View File
@@ -1,3 +1,7 @@
## 1.3.2
* Fix by @josealba to use .sizeOf(context): https://github.com/rodydavis/packages.dart/pull/14
## 1.3.0
* Update Dart SDK constraint to >=3.0.0.
+5 -7
View File
@@ -51,16 +51,14 @@ class Breakpoint {
///
/// Use [Breakpoint.fromConstraints] when the widget does not take up the full screen
factory Breakpoint.fromMediaQuery(BuildContext context) {
final _media = MediaQuery.of(context);
final size = MediaQuery.sizeOf(context);
double _width = 359;
double width = size.width;
Orientation orientation = Orientation.portrait;
final orientation =
size.width > size.height ? Orientation.landscape : Orientation.portrait;
_width = _media.size.width;
orientation = _media.orientation;
return _calcBreakpoint(orientation, _width);
return _calcBreakpoint(orientation, width);
}
static Breakpoint _calcBreakpoint(Orientation orientation, double _width) {
+2 -3
View File
@@ -1,10 +1,10 @@
name: breakpoint
description: A Flutter plugin to calculate the material design breakpoints.
version: 1.3.0
version: 1.3.2
maintainer: Rody Davis (@rodydavis)
homepage: https://github.com/rodydavis/plugins
repository: https://github.com/fluttercommunity/breakpoint
repository: https://github.com/rodydavis/packages.dart/tree/main/packages/breakpoint
resolution: workspace
environment:
@@ -19,4 +19,3 @@ dev_dependencies:
sdk: flutter
flutter:
+4
View File
@@ -1,3 +1,7 @@
# 3.0.1
- Fix iOS build error: https://github.com/rodydavis/packages.dart/pull/11
# 3.0.0
* **Breaking Change**: Migrated to Pigeon for type-safe platform channels.
@@ -13,7 +13,7 @@ public class SwiftFlutterSmsPlugin: NSObject, FlutterPlugin, SmsHostApi, UINavig
public func sendSms(message: String, recipients: [String], completion: @escaping (Result<String, Error>) -> Void) {
#if targetEnvironment(simulator)
completion(.failure(FlutterError(
completion(.failure(PigeonError(
code: "message_not_sent",
message: "Cannot send message on this device!",
details: "Cannot send SMS and MMS on a Simulator. Test on a real device."
@@ -27,7 +27,7 @@ public class SwiftFlutterSmsPlugin: NSObject, FlutterPlugin, SmsHostApi, UINavig
controller.messageComposeDelegate = self
UIApplication.shared.keyWindow?.rootViewController?.present(controller, animated: true, completion: nil)
} else {
completion(.failure(FlutterError(
completion(.failure(PigeonError(
code: "device_not_capable",
message: "The current device is not capable of sending text messages.",
details: "A device may be unable to send messages if it does not support messaging or if it is not currently configured to send messages. This only applies to the ability to send text messages via iMessage, SMS, and MMS."
@@ -36,14 +36,14 @@ public class SwiftFlutterSmsPlugin: NSObject, FlutterPlugin, SmsHostApi, UINavig
#endif
}
public func canSendSms() -> Bool {
public func canSendSms(completion: @escaping (Result<Bool, Error>) -> Void) {
#if targetEnvironment(simulator)
return false
completion(.success(false))
#else
if (MFMessageComposeViewController.canSendText()) {
return true
completion(.success(true))
} else {
return false
completion(.success(false))
}
#endif
}
+2 -2
View File
@@ -1,6 +1,6 @@
name: flutter_sms
description: A Flutter plugin to send SMS and MMS on iOS and Android.
version: 3.0.0
version: 3.0.1
homepage: https://github.com/rodydavis/packages.dart
repository: https://github.com/rodydavis/packages.dart
maintainer: Rody Davis (@rodydavis)
@@ -21,7 +21,7 @@ dependencies:
dev_dependencies:
flutter_test:
sdk: flutter
pigeon: ^26.1.5
pigeon: ^26.1.7
flutter:
plugin:
@@ -3,7 +3,13 @@ import UIKit
import AudioToolbox
public class SwiftVibratePlugin: NSObject, FlutterPlugin, VibrateApi {
private let isDevice = TARGET_OS_SIMULATOR == 0
private var isDevice: Bool {
#if targetEnvironment(simulator)
return false
#else
return true
#endif
}
public static func register(with registrar: FlutterPluginRegistrar) {
let messenger : FlutterBinaryMessenger = registrar.messenger()
+1 -1
View File
@@ -15,7 +15,7 @@ dependencies:
dev_dependencies:
flutter_lints: ^6.0.0
pigeon: ^26.1.5
pigeon: ^26.1.7
flutter:
plugin:
@@ -1 +1 @@
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"shared_preferences_foundation","path":"/Users/rodydavis/.pub-cache/hosted/pub.dev/shared_preferences_foundation-2.5.6/","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false}],"android":[{"name":"shared_preferences_android","path":"/Users/rodydavis/.pub-cache/hosted/pub.dev/shared_preferences_android-2.4.18/","native_build":true,"dependencies":[],"dev_dependency":false}],"macos":[{"name":"shared_preferences_foundation","path":"/Users/rodydavis/.pub-cache/hosted/pub.dev/shared_preferences_foundation-2.5.6/","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false}],"linux":[{"name":"path_provider_linux","path":"/Users/rodydavis/.pub-cache/hosted/pub.dev/path_provider_linux-2.2.1/","native_build":false,"dependencies":[],"dev_dependency":false},{"name":"shared_preferences_linux","path":"/Users/rodydavis/.pub-cache/hosted/pub.dev/shared_preferences_linux-2.4.1/","native_build":false,"dependencies":["path_provider_linux"],"dev_dependency":false}],"windows":[{"name":"path_provider_windows","path":"/Users/rodydavis/.pub-cache/hosted/pub.dev/path_provider_windows-2.3.0/","native_build":false,"dependencies":[],"dev_dependency":false},{"name":"shared_preferences_windows","path":"/Users/rodydavis/.pub-cache/hosted/pub.dev/shared_preferences_windows-2.4.1/","native_build":false,"dependencies":["path_provider_windows"],"dev_dependency":false}],"web":[{"name":"shared_preferences_web","path":"/Users/rodydavis/.pub-cache/hosted/pub.dev/shared_preferences_web-2.4.3/","dependencies":[],"dev_dependency":false}]},"dependencyGraph":[{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_windows","dependencies":[]},{"name":"shared_preferences","dependencies":["shared_preferences_android","shared_preferences_foundation","shared_preferences_linux","shared_preferences_web","shared_preferences_windows"]},{"name":"shared_preferences_android","dependencies":[]},{"name":"shared_preferences_foundation","dependencies":[]},{"name":"shared_preferences_linux","dependencies":["path_provider_linux"]},{"name":"shared_preferences_web","dependencies":[]},{"name":"shared_preferences_windows","dependencies":["path_provider_windows"]}],"date_created":"2026-01-15 17:05:21.433136","version":"3.38.5","swift_package_manager_enabled":{"ios":false,"macos":false}}
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"shared_preferences_foundation","path":"/Users/rodydavis/.pub-cache/hosted/pub.dev/shared_preferences_foundation-2.5.6/","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false}],"android":[{"name":"shared_preferences_android","path":"/Users/rodydavis/.pub-cache/hosted/pub.dev/shared_preferences_android-2.4.20/","native_build":true,"dependencies":[],"dev_dependency":false}],"macos":[{"name":"shared_preferences_foundation","path":"/Users/rodydavis/.pub-cache/hosted/pub.dev/shared_preferences_foundation-2.5.6/","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false}],"linux":[{"name":"path_provider_linux","path":"/Users/rodydavis/.pub-cache/hosted/pub.dev/path_provider_linux-2.2.1/","native_build":false,"dependencies":[],"dev_dependency":false},{"name":"shared_preferences_linux","path":"/Users/rodydavis/.pub-cache/hosted/pub.dev/shared_preferences_linux-2.4.1/","native_build":false,"dependencies":["path_provider_linux"],"dev_dependency":false}],"windows":[{"name":"path_provider_windows","path":"/Users/rodydavis/.pub-cache/hosted/pub.dev/path_provider_windows-2.3.0/","native_build":false,"dependencies":[],"dev_dependency":false},{"name":"shared_preferences_windows","path":"/Users/rodydavis/.pub-cache/hosted/pub.dev/shared_preferences_windows-2.4.1/","native_build":false,"dependencies":["path_provider_windows"],"dev_dependency":false}],"web":[{"name":"shared_preferences_web","path":"/Users/rodydavis/.pub-cache/hosted/pub.dev/shared_preferences_web-2.4.3/","dependencies":[],"dev_dependency":false}]},"dependencyGraph":[{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_windows","dependencies":[]},{"name":"shared_preferences","dependencies":["shared_preferences_android","shared_preferences_foundation","shared_preferences_linux","shared_preferences_web","shared_preferences_windows"]},{"name":"shared_preferences_android","dependencies":[]},{"name":"shared_preferences_foundation","dependencies":[]},{"name":"shared_preferences_linux","dependencies":["path_provider_linux"]},{"name":"shared_preferences_web","dependencies":[]},{"name":"shared_preferences_windows","dependencies":["path_provider_windows"]}],"date_created":"2026-02-16 10:38:50.657587","version":"3.38.5","swift_package_manager_enabled":{"ios":false,"macos":false}}
+1 -1
View File
@@ -14,7 +14,7 @@ dependencies:
flutter:
sdk: flutter
flutter_markdown: ^0.7.0
shared_preferences: ^2.2.0
shared_preferences: ^2.5.5
dev_dependencies:
flutter_test:
+2 -1
View File
@@ -11,4 +11,5 @@ environment:
dev_dependencies:
lints: ^6.0.0
test: ^1.24.9
flutter_test:
sdk: flutter
+175 -177
View File
@@ -1,197 +1,195 @@
import 'dart:async';
import 'package:test/test.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:undo/undo.dart';
void main() {
group('initial state', () {
test('is correct', () {
final states = <int>[];
final testObject = SimpleStack(0, onUpdate: states.add);
expect(testObject.state, 0);
});
group('initial state', () {
test('is correct', () {
final states = <int>[];
final testObject = SimpleStack(0, onUpdate: states.add);
expect(testObject.state, 0);
});
});
group('canUndo', () {
test('is false when no state changes have occurred', () async {
final states = <int>[];
final testObject = SimpleStack(0, onUpdate: states.add);
expect(testObject.canUndo, isFalse);
});
group('canUndo', () {
test('is false when no state changes have occurred', () async {
final states = <int>[];
final testObject = SimpleStack(0, onUpdate: states.add);
expect(testObject.canUndo, isFalse);
});
test('is true when a single state change has occurred', () async {
final states = <int>[];
final testObject = SimpleStack(0, onUpdate: states.add);
await Future<void>.delayed(
Duration.zero, () => testObject.modify(testObject.state + 1));
expect(testObject.canUndo, isTrue);
});
test('is false when undos have been exhausted', () async {
final states = <int>[];
final testObject = SimpleStack(0, onUpdate: states.add);
await Future<void>.delayed(
Duration.zero, () => testObject.modify(testObject.state + 1));
await Future<void>.delayed(Duration.zero, testObject.undo);
expect(testObject.canUndo, isFalse);
});
test('is true when a single state change has occurred', () async {
final states = <int>[];
final testObject = SimpleStack(0, onUpdate: states.add);
await Future<void>.delayed(
Duration.zero, () => testObject.modify(testObject.state + 1));
expect(testObject.canUndo, isTrue);
});
group('canRedo', () {
test('is false when no state changes have occurred', () async {
final states = <int>[];
final testObject = SimpleStack(0, onUpdate: states.add);
expect(testObject.canRedo, isFalse);
});
test('is false when undos have been exhausted', () async {
final states = <int>[];
final testObject = SimpleStack(0, onUpdate: states.add);
await Future<void>.delayed(
Duration.zero, () => testObject.modify(testObject.state + 1));
await Future<void>.delayed(Duration.zero, testObject.undo);
test('is true when a single undo has occurred', () async {
final states = <int>[];
final testObject = SimpleStack(0, onUpdate: states.add);
await Future<void>.delayed(
Duration.zero, () => testObject.modify(testObject.state + 1));
await Future<void>.delayed(Duration.zero, testObject.undo);
expect(testObject.canRedo, isTrue);
});
expect(testObject.canUndo, isFalse);
});
});
test('is false when redos have been exhausted', () async {
final states = <int>[];
final testObject = SimpleStack(0, onUpdate: states.add);
await Future<void>.delayed(
Duration.zero, () => testObject.modify(testObject.state + 1));
await Future<void>.delayed(Duration.zero, testObject.undo);
await Future<void>.delayed(Duration.zero, testObject.redo);
expect(testObject.canRedo, isFalse);
});
group('canRedo', () {
test('is false when no state changes have occurred', () async {
final states = <int>[];
final testObject = SimpleStack(0, onUpdate: states.add);
expect(testObject.canRedo, isFalse);
});
group('clearHistory', () {
test('clears history and redos on new testObject', () async {
final testObject = SimpleStack(0)..clearHistory();
expect(testObject.canRedo, isFalse);
expect(testObject.canUndo, isFalse);
});
test('is true when a single undo has occurred', () async {
final states = <int>[];
final testObject = SimpleStack(0, onUpdate: states.add);
await Future<void>.delayed(
Duration.zero, () => testObject.modify(testObject.state + 1));
await Future<void>.delayed(Duration.zero, testObject.undo);
expect(testObject.canRedo, isTrue);
});
group('undo', () {
test('does nothing when no state changes have occurred', () async {
final states = <int>[];
final testObject = SimpleStack(0, onUpdate: states.add);
await Future<void>.delayed(Duration.zero, testObject.undo);
test('is false when redos have been exhausted', () async {
final states = <int>[];
final testObject = SimpleStack(0, onUpdate: states.add);
await Future<void>.delayed(
Duration.zero, () => testObject.modify(testObject.state + 1));
await Future<void>.delayed(Duration.zero, testObject.undo);
await Future<void>.delayed(Duration.zero, testObject.redo);
expect(testObject.canRedo, isFalse);
});
});
expect(states, [0]);
});
group('clearHistory', () {
test('clears history and redos on new testObject', () async {
final testObject = SimpleStack(0)..clearHistory();
expect(testObject.canRedo, isFalse);
expect(testObject.canUndo, isFalse);
});
});
test('does nothing when limit is 0', () async {
final states = <int>[];
final testObject = SimpleStack(0, limit: 0, onUpdate: states.add);
await Future<void>.delayed(
Duration.zero, () => testObject.modify(testObject.state + 1));
await Future<void>.delayed(Duration.zero, testObject.undo);
group('undo', () {
test('does nothing when no state changes have occurred', () async {
final states = <int>[];
final testObject = SimpleStack(0, onUpdate: states.add);
await Future<void>.delayed(Duration.zero, testObject.undo);
expect(states, [0, 1, 0]);
});
test('loses history outside of limit', () async {
final states = <int>[];
final testObject = SimpleStack(0, limit: 1, onUpdate: states.add);
await Future<void>.delayed(
Duration.zero, () => testObject.modify(testObject.state + 1));
await Future<void>.delayed(
Duration.zero, () => testObject.modify(testObject.state + 1));
await Future<void>.delayed(Duration.zero, testObject.undo);
await Future<void>.delayed(Duration.zero, testObject.undo);
expect(states, [0, 1, 2, 1, 0]);
});
test('reverts to initial state', () async {
final states = <int>[];
final testObject = SimpleStack(0, onUpdate: states.add);
await Future<void>.delayed(
Duration.zero, () => testObject.modify(testObject.state + 1));
await Future<void>.delayed(Duration.zero, testObject.undo);
expect(states, [0, 1, 0]);
});
test('reverts to previous state with multiple state changes ', () async {
final states = <int>[];
final testObject = SimpleStack(0, onUpdate: states.add);
await Future<void>.delayed(
Duration.zero, () => testObject.modify(testObject.state + 1));
await Future<void>.delayed(
Duration.zero, () => testObject.modify(testObject.state + 1));
await Future<void>.delayed(Duration.zero, testObject.undo);
expect(states, [0, 1, 2, 1]);
});
expect(states, [0]);
});
group('redo', () {
test('does nothing when no state changes have occurred', () async {
final states = <int>[];
final testObject = SimpleStack(0, onUpdate: states.add);
await Future<void>.delayed(Duration.zero, testObject.redo);
test('does nothing when limit is 0', () async {
final states = <int>[];
final testObject = SimpleStack(0, limit: 0, onUpdate: states.add);
await Future<void>.delayed(
Duration.zero, () => testObject.modify(testObject.state + 1));
await Future<void>.delayed(Duration.zero, testObject.undo);
expect(states, [0]);
});
test('does nothing when no undos have occurred', () async {
final states = <int>[];
final testObject = SimpleStack(0, onUpdate: states.add);
await Future<void>.delayed(
Duration.zero, () => testObject.modify(testObject.state + 1));
await Future<void>.delayed(
Duration.zero, () => testObject.modify(testObject.state + 1));
await Future<void>.delayed(Duration.zero, testObject.redo);
expect(states, [0, 1, 2]);
});
test('works when one undo has occurred', () async {
final states = <int>[];
final testObject = SimpleStack(0, onUpdate: states.add);
await Future<void>.delayed(
Duration.zero, () => testObject.modify(testObject.state + 1));
await Future<void>.delayed(
Duration.zero, () => testObject.modify(testObject.state + 1));
await Future<void>.delayed(Duration.zero, testObject.undo);
await Future<void>.delayed(Duration.zero, testObject.redo);
expect(states, [0, 1, 2, 1, 2]);
});
test('does nothing when undos have been exhausted', () async {
final states = <int>[];
final testObject = SimpleStack(0, onUpdate: states.add);
await Future<void>.delayed(
Duration.zero, () => testObject.modify(testObject.state + 1));
await Future<void>.delayed(
Duration.zero, () => testObject.modify(testObject.state + 1));
await Future<void>.delayed(Duration.zero, testObject.undo);
await Future<void>.delayed(Duration.zero, testObject.redo);
await Future<void>.delayed(Duration.zero, testObject.redo);
expect(states, [0, 1, 2, 1, 2]);
});
test(
'does nothing when undos has occurred '
'followed by a new state change', () async {
final states = <int>[];
final testObject = SimpleStack(0, onUpdate: states.add);
await Future<void>.delayed(
Duration.zero, () => testObject.modify(testObject.state + 1));
await Future<void>.delayed(
Duration.zero, () => testObject.modify(testObject.state + 1));
await Future<void>.delayed(Duration.zero, testObject.undo);
await Future<void>.delayed(
Duration.zero, () => testObject.modify(testObject.state - 1));
await Future<void>.delayed(Duration.zero, testObject.redo);
expect(states, [0, 1, 2, 1, 0]);
});
expect(states, [0, 1, 0]);
});
}
test('loses history outside of limit', () async {
final states = <int>[];
final testObject = SimpleStack(0, limit: 1, onUpdate: states.add);
await Future<void>.delayed(
Duration.zero, () => testObject.modify(testObject.state + 1));
await Future<void>.delayed(
Duration.zero, () => testObject.modify(testObject.state + 1));
await Future<void>.delayed(Duration.zero, testObject.undo);
await Future<void>.delayed(Duration.zero, testObject.undo);
expect(states, [0, 1, 2, 1, 0]);
});
test('reverts to initial state', () async {
final states = <int>[];
final testObject = SimpleStack(0, onUpdate: states.add);
await Future<void>.delayed(
Duration.zero, () => testObject.modify(testObject.state + 1));
await Future<void>.delayed(Duration.zero, testObject.undo);
expect(states, [0, 1, 0]);
});
test('reverts to previous state with multiple state changes ', () async {
final states = <int>[];
final testObject = SimpleStack(0, onUpdate: states.add);
await Future<void>.delayed(
Duration.zero, () => testObject.modify(testObject.state + 1));
await Future<void>.delayed(
Duration.zero, () => testObject.modify(testObject.state + 1));
await Future<void>.delayed(Duration.zero, testObject.undo);
expect(states, [0, 1, 2, 1]);
});
});
group('redo', () {
test('does nothing when no state changes have occurred', () async {
final states = <int>[];
final testObject = SimpleStack(0, onUpdate: states.add);
await Future<void>.delayed(Duration.zero, testObject.redo);
expect(states, [0]);
});
test('does nothing when no undos have occurred', () async {
final states = <int>[];
final testObject = SimpleStack(0, onUpdate: states.add);
await Future<void>.delayed(
Duration.zero, () => testObject.modify(testObject.state + 1));
await Future<void>.delayed(
Duration.zero, () => testObject.modify(testObject.state + 1));
await Future<void>.delayed(Duration.zero, testObject.redo);
expect(states, [0, 1, 2]);
});
test('works when one undo has occurred', () async {
final states = <int>[];
final testObject = SimpleStack(0, onUpdate: states.add);
await Future<void>.delayed(
Duration.zero, () => testObject.modify(testObject.state + 1));
await Future<void>.delayed(
Duration.zero, () => testObject.modify(testObject.state + 1));
await Future<void>.delayed(Duration.zero, testObject.undo);
await Future<void>.delayed(Duration.zero, testObject.redo);
expect(states, [0, 1, 2, 1, 2]);
});
test('does nothing when undos have been exhausted', () async {
final states = <int>[];
final testObject = SimpleStack(0, onUpdate: states.add);
await Future<void>.delayed(
Duration.zero, () => testObject.modify(testObject.state + 1));
await Future<void>.delayed(
Duration.zero, () => testObject.modify(testObject.state + 1));
await Future<void>.delayed(Duration.zero, testObject.undo);
await Future<void>.delayed(Duration.zero, testObject.redo);
await Future<void>.delayed(Duration.zero, testObject.redo);
expect(states, [0, 1, 2, 1, 2]);
});
test(
'does nothing when undos has occurred '
'followed by a new state change', () async {
final states = <int>[];
final testObject = SimpleStack(0, onUpdate: states.add);
await Future<void>.delayed(
Duration.zero, () => testObject.modify(testObject.state + 1));
await Future<void>.delayed(
Duration.zero, () => testObject.modify(testObject.state + 1));
await Future<void>.delayed(Duration.zero, testObject.undo);
await Future<void>.delayed(
Duration.zero, () => testObject.modify(testObject.state - 1));
await Future<void>.delayed(Duration.zero, testObject.redo);
expect(states, [0, 1, 2, 1, 0]);
});
});
}
+13 -189
View File
@@ -61,18 +61,10 @@ packages:
dependency: transitive
description:
name: characters
sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803
sha256: faf38497bda5ead2a8c7615f4f7939df04333478bf32e4173fcb06d428b5716b
url: "https://pub.dev"
source: hosted
version: "1.4.0"
cli_config:
dependency: transitive
description:
name: cli_config
sha256: ac20a183a07002b700f0c25e61b7ee46b23c309d76ab7b7640a028f18e4d99ec
url: "https://pub.dev"
source: hosted
version: "0.2.0"
version: "1.4.1"
clock:
dependency: transitive
description:
@@ -105,14 +97,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "3.1.2"
coverage:
dependency: transitive
description:
name: coverage
sha256: "5da775aa218eaf2151c721b16c01c7676fbfdd99cebba2bf64e8b807a28ff94d"
url: "https://pub.dev"
source: hosted
version: "1.15.0"
crypto:
dependency: transitive
description:
@@ -167,7 +151,7 @@ packages:
source: sdk
version: "0.0.0"
flutter_lints:
dependency: transitive
dependency: "direct dev"
description:
name: flutter_lints
sha256: "3105dc8492f6183fb076ccf1f351ac3d60564bff92e20bfc4af9cc1651f4e7e1"
@@ -192,14 +176,6 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
frontend_server_client:
dependency: transitive
description:
name: frontend_server_client
sha256: f64a0333a82f30b0cca061bc3d143813a486dc086b574bfb233b7c1372427694
url: "https://pub.dev"
source: hosted
version: "4.0.0"
glob:
dependency: transitive
description:
@@ -216,38 +192,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.3.2"
http_multi_server:
dependency: transitive
description:
name: http_multi_server
sha256: aa6199f908078bb1c5efb8d8638d4ae191aac11b311132c3ef48ce352fb52ef8
url: "https://pub.dev"
source: hosted
version: "3.2.2"
http_parser:
dependency: transitive
description:
name: http_parser
sha256: "178d74305e7866013777bab2c3d8726205dc5a4dd935297175b19a23a2e66571"
url: "https://pub.dev"
source: hosted
version: "4.1.2"
io:
dependency: transitive
description:
name: io
sha256: dfd5a80599cf0165756e3181807ed3e77daf6dd4137caaad72d0b7931597650b
url: "https://pub.dev"
source: hosted
version: "1.0.5"
js:
dependency: transitive
description:
name: js
sha256: "53385261521cc4a0c4658fd0ad07a7d14591cf8fc33abbceae306ddb974888dc"
url: "https://pub.dev"
source: hosted
version: "0.7.2"
leak_tracker:
dependency: transitive
description:
@@ -280,14 +224,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "6.0.0"
logging:
dependency: transitive
description:
name: logging
sha256: c8245ada5f1717ed44271ed1c26b8ce85ca3228fd2ffdb75468ab01979309d61
url: "https://pub.dev"
source: hosted
version: "1.3.0"
markdown:
dependency: transitive
description:
@@ -300,18 +236,18 @@ packages:
dependency: transitive
description:
name: matcher
sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2
sha256: dc0b7dc7651697ea4ff3e69ef44b0407ea32c487a39fff6a4004fa585e901861
url: "https://pub.dev"
source: hosted
version: "0.12.17"
version: "0.12.19"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec
sha256: "9c337007e82b1889149c82ed242ed1cb24a66044e30979c44912381e9be4c48b"
url: "https://pub.dev"
source: hosted
version: "0.11.1"
version: "0.13.0"
meta:
dependency: transitive
description:
@@ -320,22 +256,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.17.0"
mime:
dependency: transitive
description:
name: mime
sha256: "41a20518f0cb1256669420fdba0cd90d21561e560ac240f26ef8322e45bb7ed6"
url: "https://pub.dev"
source: hosted
version: "2.0.0"
node_preamble:
dependency: transitive
description:
name: node_preamble
sha256: "6e7eac89047ab8a8d26cf16127b5ed26de65209847630400f9aefd7cd5c730db"
url: "https://pub.dev"
source: hosted
version: "2.0.2"
package_config:
dependency: transitive
description:
@@ -380,10 +300,10 @@ packages:
dependency: transitive
description:
name: pigeon
sha256: fcfee18cf18dae434a149879e6876214c1b57c8d2d5d0cc55a5ba0c85278b886
sha256: b12f739047654cd65338dc7e9c6c03cbd4a1de179364a45c9e8bbeccf23729c6
url: "https://pub.dev"
source: hosted
version: "26.1.5"
version: "26.1.7"
platform:
dependency: transitive
description:
@@ -400,14 +320,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.1.8"
pool:
dependency: transitive
description:
name: pool
sha256: "978783255c543aa3586a1b3c21f6e9d720eb315376a915872c61ef8b5c20177d"
url: "https://pub.dev"
source: hosted
version: "1.5.2"
pub_semver:
dependency: transitive
description:
@@ -420,10 +332,10 @@ packages:
dependency: transitive
description:
name: shared_preferences
sha256: "2939ae520c9024cb197fc20dee269cd8cdbf564c8b5746374ec6cacdc5169e64"
sha256: c3025c5534b01739267eb7d76959bbc25a6d10f6988e1c2a3036940133dd10bf
url: "https://pub.dev"
source: hosted
version: "2.5.4"
version: "2.5.5"
shared_preferences_android:
dependency: transitive
description:
@@ -472,59 +384,11 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.4.1"
shelf:
dependency: transitive
description:
name: shelf
sha256: e7dd780a7ffb623c57850b33f43309312fc863fb6aa3d276a754bb299839ef12
url: "https://pub.dev"
source: hosted
version: "1.4.2"
shelf_packages_handler:
dependency: transitive
description:
name: shelf_packages_handler
sha256: "89f967eca29607c933ba9571d838be31d67f53f6e4ee15147d5dc2934fee1b1e"
url: "https://pub.dev"
source: hosted
version: "3.0.2"
shelf_static:
dependency: transitive
description:
name: shelf_static
sha256: c87c3875f91262785dade62d135760c2c69cb217ac759485334c5857ad89f6e3
url: "https://pub.dev"
source: hosted
version: "1.1.3"
shelf_web_socket:
dependency: transitive
description:
name: shelf_web_socket
sha256: "3632775c8e90d6c9712f883e633716432a27758216dfb61bd86a8321c0580925"
url: "https://pub.dev"
source: hosted
version: "3.0.0"
sky_engine:
dependency: transitive
description: flutter
source: sdk
version: "0.0.0"
source_map_stack_trace:
dependency: transitive
description:
name: source_map_stack_trace
sha256: c0713a43e323c3302c2abe2a1cc89aa057a387101ebd280371d6a6c9fa68516b
url: "https://pub.dev"
source: hosted
version: "2.1.2"
source_maps:
dependency: transitive
description:
name: source_maps
sha256: "190222579a448b03896e0ca6eca5998fa810fda630c1d65e2f78b3f638f54812"
url: "https://pub.dev"
source: hosted
version: "0.10.13"
source_span:
dependency: transitive
description:
@@ -565,30 +429,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.2.2"
test:
dependency: transitive
description:
name: test
sha256: "75906bf273541b676716d1ca7627a17e4c4070a3a16272b7a3dc7da3b9f3f6b7"
url: "https://pub.dev"
source: hosted
version: "1.26.3"
test_api:
dependency: transitive
description:
name: test_api
sha256: ab2726c1a94d3176a45960b6234466ec367179b87dd74f1611adb1f3b5fb9d55
sha256: "8161c84903fd860b26bfdefb7963b3f0b68fee7adea0f59ef805ecca346f0c7a"
url: "https://pub.dev"
source: hosted
version: "0.7.7"
test_core:
dependency: transitive
description:
name: test_core
sha256: "0cc24b5ff94b38d2ae73e1eb43cc302b77964fbf67abad1e296025b78deb53d0"
url: "https://pub.dev"
source: hosted
version: "0.6.12"
version: "0.7.10"
typed_data:
dependency: transitive
description:
@@ -693,30 +541,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.1.1"
web_socket:
dependency: transitive
description:
name: web_socket
sha256: "34d64019aa8e36bf9842ac014bb5d2f5586ca73df5e4d9bf5c936975cae6982c"
url: "https://pub.dev"
source: hosted
version: "1.0.1"
web_socket_channel:
dependency: transitive
description:
name: web_socket_channel
sha256: d645757fb0f4773d602444000a8131ff5d48c9e47adfe9772652dd1a4f2d45c8
url: "https://pub.dev"
source: hosted
version: "3.0.3"
webkit_inspection_protocol:
dependency: transitive
description:
name: webkit_inspection_protocol
sha256: "87d3f2333bb240704cd3f1c6b5b7acd8a10e7f0bc28c28dcf14e782014f4a572"
url: "https://pub.dev"
source: hosted
version: "1.2.1"
xdg_directories:
dependency: transitive
description:
+3
View File
@@ -4,6 +4,9 @@ publish_to: none
environment:
sdk: ^3.5.0
dev_dependencies:
flutter_lints: ^6.0.0
workspace:
- packages/flutter_vibrate
- packages/flutter_sms