wt1.1.2f fix for 1.1.3
This commit is contained in:
@@ -305,15 +305,50 @@ class NumberPicker extends StatelessWidget {
|
||||
? selectedStyle
|
||||
: defaultStyle;
|
||||
|
||||
double top = defaultStyle != null && defaultStyle.fontSize != null
|
||||
? listViewHeight / 2 - defaultStyle.fontSize / 2 - 15
|
||||
: listViewHeight / 2 - 22;
|
||||
double left = defaultStyle != null && defaultStyle.fontSize != null
|
||||
? listViewWidth / 6 - defaultStyle.fontSize / 2 - 10
|
||||
: listViewHeight / 2 - 27;
|
||||
|
||||
bool isExtra = index == 0 || index == listItemCount - 1;
|
||||
|
||||
return isExtra
|
||||
? Container() //empty first and last element
|
||||
: Center(
|
||||
child: Text(
|
||||
getDisplayedValue(value),
|
||||
style: itemStyle,
|
||||
),
|
||||
child: value != selectedIntValue ?
|
||||
Container(
|
||||
padding: EdgeInsets.only(top: 15, left: 10, right: 5, bottom: 10),
|
||||
child: Stack(
|
||||
children: [
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
begin: value < selectedIntValue ? Alignment.centerRight : Alignment.centerLeft,
|
||||
end: value < selectedIntValue ? Alignment.centerLeft : Alignment.centerRight,
|
||||
colors: [Colors.white12, Colors.black12]),
|
||||
borderRadius: BorderRadius.circular(8.0),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
top: top,
|
||||
left: left,
|
||||
child:
|
||||
Text(
|
||||
getDisplayedValue(value),
|
||||
style: itemStyle,
|
||||
),
|
||||
|
||||
),
|
||||
],
|
||||
)
|
||||
) :
|
||||
|
||||
Text(
|
||||
getDisplayedValue(value),
|
||||
style: itemStyle,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
@@ -5,7 +5,6 @@ import 'package:aitrainer_app/util/common.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/scheduler.dart';
|
||||
import 'dart:math' as math;
|
||||
|
||||
class TreeView extends InheritedWidget {
|
||||
final List<Widget> children;
|
||||
@@ -99,7 +98,6 @@ class TreeViewChildState extends State<TreeViewChild> with Common, SingleTicker
|
||||
Color _color;
|
||||
double _opacity = 0;
|
||||
|
||||
/* List<Widget> listWidgets; */
|
||||
AnimationController _controller;
|
||||
Animation<double> sizeAnimation;
|
||||
|
||||
@@ -107,16 +105,6 @@ class TreeViewChildState extends State<TreeViewChild> with Common, SingleTicker
|
||||
void initState() {
|
||||
super.initState();
|
||||
isExpanded = widget.startExpanded;
|
||||
_color = Colors.transparent;
|
||||
_opacity = 0;
|
||||
/* listWidgets = List.from(widget.children); */
|
||||
|
||||
/* _controller = AnimationController(
|
||||
duration: const Duration(seconds: 1),
|
||||
vsync: this,
|
||||
);
|
||||
|
||||
sizeAnimation = Tween<double>(begin: 0.0, end: 1.0).animate(_controller);*/
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -136,105 +124,27 @@ class TreeViewChildState extends State<TreeViewChild> with Common, SingleTicker
|
||||
),
|
||||
Flexible(
|
||||
child: Container(
|
||||
/*animation: _controller,
|
||||
builder: (BuildContext context, Widget child) {
|
||||
return Transform.scale(
|
||||
scale: _controller.value,
|
||||
child: child,
|
||||
);
|
||||
},*/
|
||||
/* color: _color,
|
||||
duration: Duration(seconds: 2),
|
||||
curve: Curves.easeInOut,*/
|
||||
//height: double.infinity,
|
||||
/*child: isExpanded //animateChildren()
|
||||
? Column(
|
||||
child:
|
||||
AnimatedSwitcher(
|
||||
duration: Duration(milliseconds:900),
|
||||
reverseDuration: Duration(milliseconds:500),
|
||||
switchInCurve: Curves.easeIn,
|
||||
child: isExpanded ? Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: widget.children,
|
||||
)
|
||||
: Offstage(),*/
|
||||
child:
|
||||
/*AnimatedCrossFade(
|
||||
firstChild: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: widget.children,
|
||||
) : Offstage(),
|
||||
),
|
||||
secondChild: Offstage(),
|
||||
duration: Duration(milliseconds:800),
|
||||
crossFadeState: isExpanded ? CrossFadeState.showFirst : CrossFadeState.showSecond,
|
||||
)*/
|
||||
AnimatedSwitcher(
|
||||
duration: Duration(milliseconds:900),
|
||||
reverseDuration: Duration(milliseconds:500),
|
||||
switchInCurve: Curves.easeIn,
|
||||
child: isExpanded ? Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: widget.children,
|
||||
) : Offstage(),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
/*AnimatedList animateChildren() {
|
||||
|
||||
return AnimatedList(
|
||||
shrinkWrap: true,
|
||||
key: listKey,
|
||||
initialItemCount: listWidgets.length,
|
||||
itemBuilder: (context, index, animation) {
|
||||
return slideIt(animation, listWidgets[index]);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Widget slideIt(Animation<double> animation, Widget element) {
|
||||
|
||||
return SizeTransition(
|
||||
sizeFactor: animation,
|
||||
axis: Axis.vertical,
|
||||
child: element,
|
||||
);
|
||||
}*/
|
||||
|
||||
void toggleExpanded() {
|
||||
setState(() {
|
||||
this.isExpanded = !this.isExpanded;
|
||||
_color = isExpanded ? Colors.black12 : Colors.transparent;
|
||||
_opacity = isExpanded ? 1 : 0;
|
||||
|
||||
/* if ( isExpanded == false ) {
|
||||
_removeAllItems();
|
||||
} else {
|
||||
//_addAllItems();
|
||||
listWidgets = List.from(widget.children);
|
||||
}*/
|
||||
});
|
||||
}
|
||||
|
||||
/* void _removeAllItems() {
|
||||
final int itemCount = widget.children.length;
|
||||
|
||||
for (var i = 0; i < itemCount; i++) {
|
||||
Widget itemToRemove = listWidgets[0];
|
||||
listKey.currentState.removeItem(0,
|
||||
(BuildContext context, Animation<double> animation) => slideIt(animation, itemToRemove),
|
||||
duration: const Duration(milliseconds: 250),
|
||||
);
|
||||
|
||||
listWidgets.removeAt(0);
|
||||
}
|
||||
}
|
||||
|
||||
void _addAllItems() {
|
||||
final int itemCount = widget.children.length;
|
||||
|
||||
for (var i = 0; i < itemCount; i++) {
|
||||
listKey.currentState.insertItem(0);
|
||||
listWidgets.insert(0, widget.children[i]);
|
||||
}
|
||||
}*/
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user