-
Notifications
You must be signed in to change notification settings - Fork 47
/
Copy pathLiquid_Swipe Animation
127 lines (115 loc) · 3.99 KB
/
Liquid_Swipe Animation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
import 'package:flutter/material.dart';
import 'package:liquid_swipe/liquid_swipe.dart';
import 'package:smooth_page_indicator/smooth_page_indicator.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Flutter Demo',
theme: ThemeData(
// This is the theme of your application.
//
// Try running your application with "flutter run". You'll see the
// application has a blue toolbar. Then, without quitting the app, try
// changing the primarySwatch below to Colors.green and then invoke
// "hot reload" (press "r" in the console where you ran "flutter run",
// or simply save your changes to "hot reload" in a Flutter IDE).
// Notice that the counter didn't reset back to zero; the application
// is not restarted.
primarySwatch: Colors.blue,
),
home: const MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key, required this.title});
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
final colors=[Colors.orange,Colors.cyanAccent];
final controlller=LiquidController();
List<Color> color=[
Colors.red,
Colors.blue,
Colors.green,
];
int index1=0;
Map<int, Color> colorCodes = {
50: Color.fromRGBO(147, 205, 72, .1),
100: Color.fromRGBO(147, 205, 72, .2),
200: Color.fromRGBO(147, 205, 72, .3),
300: Color.fromRGBO(147, 205, 72, .4),
400: Color.fromRGBO(147, 205, 72, .5),
500: Color.fromRGBO(147, 205, 72, .6),
600: Color.fromRGBO(147, 205, 72, .7),
700: Color.fromRGBO(147, 205, 72, .8),
800: Color.fromRGBO(147, 205, 72, .9),
900: Color.fromRGBO(147, 205, 72, 1),
};
@override
Widget build(BuildContext context) {
// This method is rerun every time setState is called, for instance as done
// by the _incrementCounter method above.
//
// The Flutter framework has been optimized to make rerunning build methods
// fast, so that you can just rebuild anything that needs updating rather
// than having to individually change instances of widgets.
return Scaffold(
body:Container(color: Colors.grey,
child: Stack(
children: [
LiquidSwipe(liquidController: controlller,enableSideReveal: true,
slideIconWidget: Icon(Icons.arrow_back_ios_new_rounded),onPageChangeCallback: (index){
setState((){});
},waveType:WaveType.liquidReveal,pages: [
Container(
decoration: BoxDecoration(image: DecorationImage(image: AssetImage("assets/1.jpg"),fit:BoxFit.fill),
)),
Container(
decoration: BoxDecoration(image: DecorationImage(image: AssetImage("assets/2.jpg"),fit:BoxFit.fill),
),),
Container(
decoration: BoxDecoration(image: DecorationImage(image: AssetImage("assets/3.jpg"),fit:BoxFit.fill),)),
Container(
decoration: BoxDecoration(image: DecorationImage(image: AssetImage("assets/4.jpg"),fit:BoxFit.fill),)),
]),Positioned(
bottom: 20,
left: 110,
child: AnimatedSmoothIndicator(
curve: Curves.bounceInOut,
activeIndex: controlller.currentPage,
count: 4,
onDotClicked:(index){
controlller.animateToPage(page: index);
},effect:CustomizableEffect(
activeDotDecoration: DotDecoration(
height: 30,
width: 20,
color: Colors.blueAccent,
verticalOffset: 3,
rotationAngle: 90,borderRadius: BorderRadius.all(Radius.circular(20))
),
dotDecoration: DotDecoration(
height: 30,
width: 20,borderRadius: BorderRadius.all(Radius.circular(20)),
color:Colors.grey,
verticalOffset: 3,
rotationAngle: -90
),
spacing: 15
),
)
)
]),)
);
}
}