Flutter-Neumorphic
Flutter-Neumorphic copied to clipboard
How to make the NeumorphicIcon change IconData at the beginning, not at the end of depth change animation?
I really love this package, but I ran into an "issue", I tried looking through the docs but couldn't find a way to "fix" this.
So what I want, is that the icon changes at the beginning, now first of all to address it, in my real app the Icon rises from depth=0 to normal depth, but the iconData could be any of it, meaning that the iconData has to change before the animation, or else it will change at the end of the animation, which doesn't look good.
In the exemple below, you can see what I mean, the icon rises, but the IconData changes after the animation.
import 'package:flutter_neumorphic/flutter_neumorphic.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
bool activated = true;
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: Center(
child: Container(
child: GestureDetector(
onTap: (){
setState(() {
activated = !activated;
});
},
child: NeumorphicIcon(
activated ? Icons.add : Icons.close,
duration: Duration(seconds: 5),
size: 85,
style: NeumorphicStyle(
border: NeumorphicBorder(color: NeumorphicColors.darkDefaultBorder),
depth: activated ? 30 : 0,
),
),
),
),
),
),
);
}
}
Example in action:
So if im honest im quite new to GitHub, but maybe you can tell me the relevant files, at the moment im thinking its the "fault" of the AnimatedContainer in src/widget/text.dart 226:16 but I dont really know what to do about it, so I was wondering if you could give me an Idea/tell me how to stop this behaviour.