Add base interactive layout "rive" whit animation
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rive/rive.dart';
|
||||
|
||||
class AnimatedBtn extends StatelessWidget {
|
||||
const AnimatedBtn({
|
||||
Key? key,
|
||||
required RiveAnimationController btnAnimationController,
|
||||
required this.press,
|
||||
}) : _btnAnimationController = btnAnimationController,
|
||||
super(key: key);
|
||||
|
||||
final RiveAnimationController _btnAnimationController;
|
||||
final VoidCallback press;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GestureDetector(
|
||||
onTap: press,
|
||||
child: SizedBox(
|
||||
height: 64,
|
||||
width: 236,
|
||||
child: Stack(
|
||||
children: [
|
||||
RiveAnimation.asset(
|
||||
"assets/RiveAssets/button.riv",
|
||||
controllers: [_btnAnimationController],
|
||||
),
|
||||
Positioned.fill(
|
||||
top: 8,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
const Icon(CupertinoIcons.arrow_right),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
"Start the course",
|
||||
style: Theme.of(context).textTheme.labelLarge,
|
||||
)
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user