- Updated RxDart to 24.1
- Switch from inheritFromWidgetOfExactType to dependOnInheritedWidgetOfExactType on AppStateProvider class
- Fix package description
- Integrated frideos_core in the package
- Removed shared preferences helpers
- Improved Readme.md, added an article
- CompositeItem fix
- ScenesWidget class renamed to ScenesCreate
- TweenAnimation to AnimationTween
- CurvedTween to AnimationCurved
- AnimationWidget to AnimationCreate
- CompositeTween to CompositeItem
- CompositeAnimation to AnimationComposite
- CompositeAnimationWidget to CompositeCreate
- Improved the AnimationCreate widget.
- Updated to RxDart 23.1
- Added classes for managing scenes: ScenesObject and ScenesWidget.
- Updated to RxDart 22.6
- Updated to SharedPreferences 0.5.4
- Removed sliders widgets
- Added helpers class for animations: TweenAnimation, CurvedTween, CompositeAnimation, CompositeTween
- Updated to frideos_core 0.5.0
- Updated to RxDart 0.22.0
- Added the parameter
initAppState
(set totrue
by default) to theAppStateProvider
widget. Setting it tofalse
theinit
method of theAppStateModel
derived class passed to theappState
parameter won't be called to theinitState
method of theAppStateProvider
. - Bugfix to the
Blur
widgets. - Update README.md: added a
Dynamic fields validation
example. - Updated to frideos_core 0.4.4.
-
Update README.md: added a new example.
-
Bugfix to the
LinearTransition
widget.
-
Breaking change: integrated the frideos_core package. It now mandatory to import the file
frideos_core/frideos_core.dart
to use the StreamedObjects. -
Updated the README.md.
-
Updated dependency to RxDart version ^0.21
-
Update the README.md: added a new example app (a Todo app).
-
Package refactoring: in the example folder there is now a simple example of a counter implemented with this library (the previous examples in this repository).
-
Added some unit tests.
- Breaking change: the name of the parameter
stream
of theValueBuilder
widget was changed tostreamed
to highlight this is intended to use with the classes that implement theStreamedObject
interface. - Code refactoring
- Tests updated
README.md
updated
- Code refactoring
- Update Readme.md
- Added
AddAll
method.
-
added
AnimatedType
enum, to handle the behavior of the animated object. -
added
startAnimation
method: it is now possible specify a type of behavior (increment or decrement the value), the velocity, a minValue (in case of decrement) and a maxValue (increment). -
added
outStream
getter (deprecated:animationStream
). -
Code refactoring.
- Docs improved
- Code refactoring
Due to various changes in the code this version could cause issues on apps based on a previous version. Now, all the StreamedObjects need to have passed their value to the initialData
parameter of the StreamBuilder/StreamedWidget (e.g. using the getter value
of the StreamedObjects). As an alternative, they can be used with the new ValueBuilder
widget, it extends the StreamBuilder class and get the value from the StreamedObject to pass to the initialData
parameter.
By extending the AppStateModel interface it is possible to create a class to drive the AppStateProvider in order to provide the data to the widgets.
Simple state provider that extends a StatefulWidget and use an InheritedWidget to share the state with the widgets on the tree. Used along with streams, it is possibile for the widgets the access this data to modify it and propagates the changes on the entire widgets tree.
From the "theme changer" example:
class AppState extends AppStateModel {
List<MyTheme> themes;
StreamedValue<MyTheme> currentTheme;
AppState() {
print('-------APP STATE INIT--------');
themes = List<MyTheme>();
themes.addAll([
MyTheme(
name: 'Default',
brightness: Brightness.light,
backgroundColor: Colors.blue[50],
scaffoldBackgroundColor: Colors.blue[50],
primaryColor: Colors.blue,
primaryColorBrightness: Brightness.dark,
accentColor: Colors.blue[300],
),
MyTheme(
name: 'Teal',
brightness: Brightness.light,
backgroundColor: Colors.teal[50],
scaffoldBackgroundColor: Colors.teal[50],
primaryColor: Colors.teal[600],
primaryColorBrightness: Brightness.dark,
accentColor: Colors.teal[300],
),
MyTheme(
name: 'Orange',
brightness: Brightness.light,
backgroundColor: Colors.orange[50],
scaffoldBackgroundColor: Colors.orange[50],
primaryColor: Colors.orange[600],
primaryColorBrightness: Brightness.dark,
accentColor: Colors.orange[300],
),
]);
currentTheme = StreamedValue();
}
void setTheme(MyTheme theme) {
currentTheme.value = theme;
Prefs.savePref<String>('theme', theme.name);
}
@override
void init() async {
String lastTheme = await Prefs.getPref('theme');
if (lastTheme != null) {
currentTheme.value =
themes.firstWhere((theme) => theme.name == lastTheme);
} else {
currentTheme.value = themes[1];
}
}
@override
dispose() {
print('---------APP STATE DISPOSE-----------');
currentTheme.dispose();
}
}
void main() => runApp(App());
class App extends StatefulWidget {
@override
_AppState createState() => _AppState();
}
class _AppState extends State<App> {
AppState appState;
@override
void initState() {
super.initState();
appState = AppState();
}
@override
Widget build(BuildContext context) {
return AppStateProvider<AppState>(
appState: appState,
child: MaterialPage(),
);
}
}
class MaterialPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
var theme = AppStateProvider.of<AppState>(context).currentTheme;
return ValueBuilder<MyTheme>(
stream: theme,
builder: (context, snapshot) {
return MaterialApp(
title: "Theme and drawer starter app",
theme: _buildThemeData(snapshot.data),
home: HomePage());
});
}
_buildThemeData(MyTheme appTheme) {
return ThemeData(
brightness: appTheme.brightness,
backgroundColor: appTheme.backgroundColor,
scaffoldBackgroundColor: appTheme.scaffoldBackgroundColor,
primaryColor: appTheme.primaryColor,
primaryColorBrightness: appTheme.primaryColorBrightness,
accentColor: appTheme.accentColor,
);
}
}
class SettingsPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
var appState = AppStateProvider.of<AppState>(context);
_buildThemesList() {
return appState.themes.map((MyTheme appTheme) {
return DropdownMenuItem<MyTheme>(
value: appTheme,
child: Text(appTheme.name, style: TextStyle(fontSize: 14.0)),
);
}).toList();
}
return Scaffold(
appBar: AppBar(
centerTitle: true,
title: Text(
"Settings",
),
),
body: Container(
padding: EdgeInsets.all(8.0),
child: Column(
children: <Widget>[
Column(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
'Choose a theme:',
style: TextStyle(fontWeight: FontWeight.w500),
),
),
ValueBuilder<MyTheme>(
stream: appState.currentTheme,
builder: (context, snapshot) {
return DropdownButton<MyTheme>(
hint: Text("Status"),
value: snapshot.data,
items: _buildThemesList(),
onChanged: appState.setTheme,
);
}),
],
),
],
),
),
);
}
}
Similar to the StreamedWidget, it extends the StreamBuilder class but takes as a stream parameter an object that implements the StreamedObject interface.
From the previous example:
ValueBuilder<MyTheme>(
stream: theme,
builder: (context, snapshot) {
return MaterialApp(
title: "Theme and drawer starter app",
theme: _buildThemeData(snapshot.data),
home: HomePage(),
);
}
)
StreamedList and StreamedMap by default aren't initialiazed (to avoid that when using them along with a StreamBuilder/StreamedWidget the snaphost.hasData
is true from the beginning,becoming harder to show for example a loading spinner without using a workaround).
- Added
initialData
parameter to the constructor to all the streamed classes to initialize the stream with an initial data.
- replaceAt
- replace
By default, the debug console messages on disposing of streams are now disabled. Use this method to reenable this behavior.
e.g. from the "StreamedObjects" example:
// Activate the debug console messages on disposing
count.debugMode();
countMemory.debugMode();
countHistory.debugMode();
timerObject.debugMode();
counterObj.debugMode();
This will be applied to:
- StreamedValue
- StreamedTransformed
- MemoryObject
- HistoryObject
- StreamedList
- StreamedMap
Intead of animateObject.animation.value, now the current value of the animation it is accessible just by using the 'value' setter/getter:
animatedObject.value += 0.1;
// It is the same as animatedObject.animation.value += 0.1
- BlurWidget
- BlurInWidget
- BlurOutWidget
- AnimatedBlurWidget
- WavesWidget
e.g. streamedList.length
it is the same as: streamedList.value.length
- removeElement
- removeAt
- clear
e.g. streamedMap.length
it is the same as: streamedMap.value.length
- AddKey
- removeKey
- clear