-
Notifications
You must be signed in to change notification settings - Fork 202
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
some small code improvements - reorganize code to get things ready for binding text runs - support to bind color two way - fix bug: new data binds not updating if they were created in animate mode Diffs= 9cd8759a0 Xxxx data binding data context (#7454) Co-authored-by: hernan <hernan@rive.app>
- Loading branch information
Showing
10 changed files
with
165 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
31f5ee5c480ab9b2c1a0d263305f56bfd943d780 | ||
9cd8759a02aaa45684e80a8d77671c1536ab387d |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import 'package:rive/src/core/core.dart'; | ||
import 'package:rive/src/rive_core/viewmodel/viewmodel_instance_value.dart'; | ||
|
||
abstract class ContextValue { | ||
ViewModelInstanceValue? source; | ||
ContextValue(this.source); | ||
void apply(Core<CoreContext> core, int propertyKey); | ||
void applyToSource(Core<CoreContext> core, int propertyKey); | ||
void update(Core<CoreContext> core) {} | ||
} |
21 changes: 21 additions & 0 deletions
21
lib/src/rive_core/data_bind/context/context_value_color.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import 'package:rive/src/core/core.dart'; | ||
import 'package:rive/src/rive_core/data_bind/context/context_value.dart'; | ||
|
||
import 'package:rive/src/rive_core/viewmodel/viewmodel_instance_color.dart'; | ||
import 'package:rive/src/rive_core/viewmodel/viewmodel_instance_value.dart'; | ||
|
||
class ContextValueColor extends ContextValue { | ||
ContextValueColor(ViewModelInstanceValue? source) : super(source); | ||
|
||
@override | ||
void apply(Core<CoreContext> core, int propertyKey) { | ||
if (source?.coreType == ViewModelInstanceColorBase.typeKey) { | ||
final sourceColor = source as ViewModelInstanceColor; | ||
|
||
RiveCoreContext.setColor(core, propertyKey, sourceColor.propertyValue); | ||
} | ||
} | ||
|
||
@override | ||
void applyToSource(Core<CoreContext> core, int propertyKey) {} | ||
} |
17 changes: 17 additions & 0 deletions
17
lib/src/rive_core/data_bind/context/context_value_enum.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import 'package:rive/src/core/core.dart'; | ||
import 'package:rive/src/rive_core/data_bind/context/context_value.dart'; | ||
import 'package:rive/src/rive_core/viewmodel/viewmodel_instance_value.dart'; | ||
|
||
class ContextValueEnum extends ContextValue { | ||
ContextValueEnum(ViewModelInstanceValue? source) : super(source); | ||
|
||
@override | ||
void apply(Core<CoreContext> core, int propertyKey) { | ||
// TODO: @hernan implement | ||
} | ||
|
||
@override | ||
void applyToSource(Core<CoreContext> core, int propertyKey) { | ||
// TODO: @hernan implement | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
lib/src/rive_core/data_bind/context/context_value_list.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import 'package:rive/src/core/core.dart'; | ||
import 'package:rive/src/rive_core/data_bind/context/context_value.dart'; | ||
import 'package:rive/src/rive_core/viewmodel/viewmodel_instance_value.dart'; | ||
|
||
class ContextValueList extends ContextValue { | ||
ContextValueList(ViewModelInstanceValue? source) : super(source); | ||
|
||
@override | ||
void apply(Core<CoreContext> core, int propertyKey) { | ||
// TODO: @hernan implement | ||
} | ||
|
||
@override | ||
void applyToSource(Core<CoreContext> core, int propertyKey) { | ||
// TODO: @hernan implement | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
lib/src/rive_core/data_bind/context/context_value_number.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import 'package:rive/src/core/core.dart'; | ||
import 'package:rive/src/rive_core/data_bind/context/context_value.dart'; | ||
|
||
import 'package:rive/src/rive_core/viewmodel/viewmodel_instance_number.dart'; | ||
import 'package:rive/src/rive_core/viewmodel/viewmodel_instance_value.dart'; | ||
|
||
class ContextValueNumber extends ContextValue { | ||
ContextValueNumber(ViewModelInstanceValue? source) : super(source); | ||
|
||
@override | ||
void apply(Core<CoreContext> core, int propertyKey) { | ||
if (source?.coreType == ViewModelInstanceNumberBase.typeKey) { | ||
final sourceNumber = source as ViewModelInstanceNumber; | ||
|
||
RiveCoreContext.setDouble(core, propertyKey, sourceNumber.propertyValue); | ||
} | ||
} | ||
|
||
@override | ||
void applyToSource(Core<CoreContext> core, int propertyKey) { | ||
final value = RiveCoreContext.getDouble(core, propertyKey); | ||
final sourceNumber = source as ViewModelInstanceNumber; | ||
sourceNumber.propertyValue = value; | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
lib/src/rive_core/data_bind/context/context_value_string.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import 'package:rive/src/core/core.dart'; | ||
import 'package:rive/src/rive_core/data_bind/context/context_value.dart'; | ||
|
||
import 'package:rive/src/rive_core/viewmodel/viewmodel_instance_string.dart'; | ||
import 'package:rive/src/rive_core/viewmodel/viewmodel_instance_value.dart'; | ||
|
||
class ContextValueString extends ContextValue { | ||
ContextValueString(ViewModelInstanceValue? source) | ||
: super(source as ViewModelInstanceString); | ||
@override | ||
void apply(Core<CoreContext> core, int propertyKey) { | ||
if (source?.coreType == ViewModelInstanceStringBase.typeKey) { | ||
final sourceString = source as ViewModelInstanceString; | ||
|
||
RiveCoreContext.setString(core, propertyKey, sourceString.propertyValue); | ||
} | ||
} | ||
|
||
@override | ||
void applyToSource(Core<CoreContext> core, int propertyKey) { | ||
final value = RiveCoreContext.getString(core, propertyKey); | ||
final sourceString = source as ViewModelInstanceString; | ||
sourceString.propertyValue = value; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters