-
Notifications
You must be signed in to change notification settings - Fork 64
/
Copy path21. floating_action_sheet.dart
101 lines (96 loc) · 3.95 KB
/
21. floating_action_sheet.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
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 FlutterFloatingSheetWidget extends StatelessWidget {
const FlutterFloatingSheetWidget({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
kDivider() => Padding(
padding: const EdgeInsets.symmetric(vertical: 5),
child: Divider(thickness: 0.5, color: Colors.white.withOpacity(0.5)),
);
kButton({required IconData iconData, required String title}) => Row(
children: [
const SizedBox(width: 20),
Icon(iconData, size: 16),
const SizedBox(width: 10),
Text(title, style: boldText(fSize: 16))
],
);
showSheet() {
return showModalBottomSheet(
backgroundColor: Colors.transparent,
shape:
RoundedRectangleBorder(borderRadius: BorderRadius.circular(25)),
barrierColor: Colors.transparent,
context: context,
builder: (context) {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 20),
child: Container(
height: 300,
decoration: BoxDecoration(
color: bgColor, borderRadius: BorderRadius.circular(26)),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(height: 10),
Row(
children: [
const SizedBox(width: 20),
const CircleAvatar(
radius: 16,
backgroundImage:
AssetImage("assets/naruto.jpeg")),
const SizedBox(width: 10),
Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text("Naruto : Shippuden", style: boldText()),
Text("Anime about naruto and his adventures",
style: regulerText)
],
),
const Spacer(),
IconButton(
onPressed: () {
Navigator.pop(context);
},
icon: const Icon(Icons.arrow_forward_ios,
size: 12, color: Colors.white)),
const SizedBox(width: 5)
],
),
kDivider(),
kButton(
iconData: Icons.remove_red_eye, title: "Watch now"),
kDivider(),
kButton(iconData: Icons.thumb_up, title: "Dislike"),
kDivider(),
kButton(iconData: Icons.thumb_down, title: "Dislike"),
kDivider(),
kButton(iconData: Icons.share, title: "Share"),
],
),
),
),
);
});
}
return Scaffold(
appBar: AppBar(
backgroundColor: bgColor,
title: Text("Flutter Floating Bottom Sheet", style: boldText())),
backgroundColor: bgColorFaint,
body: Center(
child: ActionChip(
label: Text("Show sheet", style: regulerText),
onPressed: () {
showSheet();
})));
}
}