-
Notifications
You must be signed in to change notification settings - Fork 64
/
28.flutter_navigation_animation.dart
87 lines (82 loc) · 2.6 KB
/
28.flutter_navigation_animation.dart
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
import 'package:animations/animations.dart';
import 'package:flutter/material.dart';
import 'package:ig_posts/features/1.flutter_frost_glass.view.dart';
import 'package:ig_posts/features/5.flutter_swiggy_button.dart';
class FlutteHeroAnimationWidget extends StatelessWidget {
const FlutteHeroAnimationWidget({super.key});
@override
Widget build(BuildContext context) {
List<String> fakeData = [
"🍔 Burger",
"🍟 Fries",
"🍗 Chicken",
"🍅 Ketchup",
"🍗 Meat",
"💧 Water",
"🍕 Pizza",
"🍜 Noodles",
"🍨 Ice cream",
"🍊 Orange",
"🌭 Sausage",
"🍱 Meal"
];
return Scaffold(
appBar: AppBar(
backgroundColor: bgColorFaint,
title:
Text("Flutter Animated Navigation", style: boldText(fSize: 20))),
backgroundColor: bgColor,
body: GridView.builder(
shrinkWrap: true,
gridDelegate:
const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2),
itemCount: fakeData.length,
itemBuilder: (BuildContext context, int index) {
return OpenContainer(
openColor: bgColor,
closedBuilder: (_, openContainer) {
return Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
child: Center(
child:
Text(fakeData[index], style: boldText(fSize: 28))),
decoration: BoxDecoration(
color: bgColorFaint,
borderRadius: BorderRadius.circular(12)),
),
);
},
closedColor: bgColor,
closedElevation: 5.0,
openBuilder: (_, closeContainer) {
return OpenedUpPage(callbackData: fakeData[index]);
});
},
),
);
}
}
class OpenedUpPage extends StatelessWidget {
final String callbackData;
const OpenedUpPage({required this.callbackData, super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
floatingActionButton: FloatingActionButton(
backgroundColor: bgColorFaint,
child: Icon(
Icons.arrow_back_ios,
color: Colors.white,
),
onPressed: () {
Navigator.pop(context);
}),
backgroundColor: bgColor,
body: Center(
child: Text(callbackData, style: boldText(fSize: 30)),
),
);
}
}