Advertisement
Nisanth-Reddy

Animation

May 18th, 2021
281
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.42 KB | None | 0 0
  1. import 'package:flutter/material.dart';
  2.  
  3. void main() {
  4. runApp(MaterialApp(
  5. theme: ThemeData(primarySwatch: Colors.deepOrange),
  6. home: MyApp(),
  7. ));
  8. }
  9.  
  10. class MyApp extends StatefulWidget {
  11. @override
  12. State<StatefulWidget> createState() {
  13. return MyAppState();
  14. }
  15. }
  16.  
  17. class MyAppState extends State<MyApp> with TickerProviderStateMixin {
  18. bool showA = false;
  19. bool showB = false;
  20. bool showC = false;
  21. bool showD = false;
  22.  
  23. AnimationController controller;
  24.  
  25. @override
  26. void initState() {
  27. super.initState();
  28. // controller
  29. }
  30.  
  31. // This widget is the root of your application.
  32. @override
  33. Widget build(BuildContext context) {
  34. var Width = MediaQuery.of(context).size.width;
  35. return Scaffold(
  36. appBar: AppBar(title: Text('Animation')),
  37. body: Container(
  38. child: Padding(
  39. padding: const EdgeInsets.only(left: 13, right: 13, top: 13),
  40. child: Container(
  41. decoration: BoxDecoration(
  42. color: Colors.white,
  43. borderRadius: BorderRadius.all(Radius.circular(10)),
  44. boxShadow: [
  45. BoxShadow(
  46. color: Colors.grey.withOpacity(0.1),
  47. spreadRadius: 2,
  48. blurRadius: 3,
  49. offset: Offset(0, 3), // changes position of shadow
  50. ),
  51. ],
  52. ),
  53. child: Padding(
  54. padding: const EdgeInsets.all(8.0),
  55. child: Container(
  56. child: Center(
  57. child: Column(
  58. crossAxisAlignment: CrossAxisAlignment.center,
  59. mainAxisAlignment: MainAxisAlignment.center,
  60. children: [
  61. Padding(
  62. padding: const EdgeInsets.only(left: 8, right: 8),
  63. child: Row(
  64. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  65. crossAxisAlignment: CrossAxisAlignment.center,
  66. children: [
  67. Text(
  68. 'DIAGNOSIS',
  69. style: TextStyle(
  70. color: Colors.black,
  71. fontFamily: 'PoppinsMedium',
  72. fontSize: 14),
  73. ),
  74. showB
  75. ? GestureDetector(
  76. onTap: () {
  77. print('false');
  78. setState(() {
  79. showB = false;
  80. });
  81. },
  82. child:
  83. Icon(Icons.keyboard_arrow_up_outlined))
  84. : GestureDetector(
  85. onTap: () {
  86. print('true');
  87. setState(() {
  88. showB = true;
  89. });
  90. },
  91. child: Icon(
  92. Icons.keyboard_arrow_down_outlined))
  93. ],
  94. ),
  95. ),
  96. AnimatedSize(
  97. vsync: this,
  98. duration: Duration(milliseconds: 250),
  99. child: Container(
  100. height: showB ? null : 0,
  101. child: Column(
  102. children: [
  103. Padding(
  104. padding: const EdgeInsets.only(top: 8),
  105. child: Container(
  106. width: Width * 0.9,
  107. child: Divider(
  108. color: Colors.grey,
  109. ),
  110. ),
  111. ),
  112. Padding(
  113. padding: const EdgeInsets.only(
  114. left: 8, right: 8, bottom: 8, top: 2),
  115. child: Container(
  116. child: Column(
  117. crossAxisAlignment:
  118. CrossAxisAlignment.start,
  119. children: [
  120. Padding(
  121. padding: const EdgeInsets.only(
  122. top: 10, left: 7, bottom: 5),
  123. child: Text('Diagnosis',
  124. textAlign: TextAlign.left,
  125. style: TextStyle(
  126. fontFamily: 'PoppinsRegular',
  127. color: Colors.black,
  128. )),
  129. ),
  130. Container(
  131. width: Width * 0.92,
  132. child: TextFormField(
  133. onChanged: (value) {},
  134. onSaved: (value) {},
  135. style: TextStyle(
  136. fontSize: 15,
  137. color: Colors.black,
  138. fontFamily: 'UbuntuRegular'),
  139. decoration: new InputDecoration(
  140. suffixIcon: IconButton(
  141. icon: Icon(
  142. Icons.search_outlined,
  143. color: Color(0xffbdbdbd),
  144. ),
  145. ),
  146. border: new OutlineInputBorder(
  147. borderSide: const BorderSide(
  148. color: Color(0xffbdbdbd),
  149. width: 1),
  150. borderRadius:
  151. const BorderRadius.all(
  152. const Radius.circular(10.0),
  153. ),
  154. ),
  155. enabledBorder:
  156. new OutlineInputBorder(
  157. borderSide: const BorderSide(
  158. color: Color(0xffbdbdbd),
  159. width: 1),
  160. borderRadius:
  161. const BorderRadius.all(
  162. const Radius.circular(10.0),
  163. ),
  164. ),
  165. filled: true,
  166. hintStyle: new TextStyle(
  167. color: Color(0xffbdbdbd),
  168. fontFamily: 'UbuntuRegular'),
  169. hintText: "Enter Diagnosis",
  170. fillColor: Colors.white70,
  171. focusedBorder: OutlineInputBorder(
  172. borderSide: const BorderSide(
  173. color: Colors.black,
  174. width: 1),
  175. borderRadius:
  176. const BorderRadius.all(
  177. const Radius.circular(10.0),
  178. ),
  179. ),
  180. ),
  181. ),
  182. ),
  183. Padding(
  184. padding: const EdgeInsets.only(
  185. top: 10, left: 7, bottom: 5),
  186. child: Text('Comments',
  187. textAlign: TextAlign.left,
  188. style: TextStyle(
  189. fontFamily: 'PoppinsRegular',
  190. color: Colors.black,
  191. )),
  192. ),
  193. Container(
  194. width: Width * 0.92,
  195. child: TextFormField(
  196. maxLines:
  197. 5, // when user presses enter it will adapt to it
  198. onChanged: (value) {},
  199. onSaved: (value) {},
  200. style: TextStyle(
  201. fontSize: 15,
  202. color: Colors.black,
  203. fontFamily: 'UbuntuRegular'),
  204. decoration: new InputDecoration(
  205. border: new OutlineInputBorder(
  206. borderSide: const BorderSide(
  207. color: Color(0xffbdbdbd),
  208. width: 1),
  209. borderRadius:
  210. const BorderRadius.all(
  211. const Radius.circular(10.0),
  212. ),
  213. ),
  214. enabledBorder:
  215. new OutlineInputBorder(
  216. borderSide: const BorderSide(
  217. color: Color(0xffbdbdbd),
  218. width: 1),
  219. borderRadius:
  220. const BorderRadius.all(
  221. const Radius.circular(10.0),
  222. ),
  223. ),
  224. filled: true,
  225. hintStyle: new TextStyle(
  226. color: Color(0xffbdbdbd),
  227. fontFamily: 'UbuntuRegular'),
  228. hintText: "Enter Comments",
  229. fillColor: Colors.white70,
  230. focusedBorder: OutlineInputBorder(
  231. borderSide: const BorderSide(
  232. color: Colors.black,
  233. width: 1),
  234. borderRadius:
  235. const BorderRadius.all(
  236. const Radius.circular(10.0),
  237. ),
  238. ),
  239. ),
  240. ),
  241. ),
  242. Align(
  243. alignment: Alignment.centerRight,
  244. child: Padding(
  245. padding:
  246. const EdgeInsets.only(top: 13),
  247. child: Container(
  248. decoration: BoxDecoration(
  249. color: Colors.black,
  250. shape: BoxShape.circle,
  251. ),
  252. child: Padding(
  253. padding:
  254. const EdgeInsets.all(4.0),
  255. child: Icon(Icons.add,
  256. size: 25.0,
  257. color: Colors.white),
  258. )),
  259. )),
  260. Align(
  261. alignment: Alignment.center,
  262. child: Padding(
  263. padding: const EdgeInsets.only(
  264. top: 15, left: 7, bottom: 5),
  265. child: RawMaterialButton(
  266. onPressed: () {
  267. print('sad');
  268. setState(() {
  269. showA = false;
  270. showB = false;
  271. showC = true;
  272. showD = false;
  273. });
  274. },
  275. elevation: 2.0,
  276. fillColor: Colors.white,
  277. child: Icon(Icons.check_outlined,
  278. size: 35.0,
  279. color: Colors.black),
  280. padding: EdgeInsets.all(15.0),
  281. shape: CircleBorder(),
  282. ),
  283. ),
  284. )
  285. ],
  286. ),
  287. ),
  288. )
  289. ],
  290. ),
  291. ),
  292. )
  293. ],
  294. ),
  295. ),
  296. ),
  297. ),
  298. ),
  299. ),
  300. ),
  301. );
  302. }
  303. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement