11import 'package:flutter/material.dart' ;
22import 'package:ui_kit/components/toast/gf_toast.dart' ;
33
4-
5-
64class GFFloatingWidget extends StatefulWidget {
7-
8- const GFFloatingWidget ({
9- Key key,
10- this .child,
11- this .horizontalPosition,
12- this .verticalPosition,
13- this .body
14- }) : super (key: key);
15-
16-
5+ const GFFloatingWidget (
6+ {Key key,
7+ this .child,
8+ this .horizontalPosition,
9+ this .verticalPosition,
10+ this .body})
11+ : super (key: key);
12+
13+ ///child of type [Widget] which floats across the body based on horizontal and vertical position
1714 final Widget child;
1815
16+ ///body of type [Widget] which is same as Scaffold's body
1917 final Widget body;
2018
19+ /// horizontalPosition of type [double] which aligns the child horizontally across the body
2120 final double horizontalPosition;
2221
23-
22+ /// verticalPosition of type [double] which aligns the child vertically across the body
2423 final double verticalPosition;
2524
2625 @override
@@ -34,17 +33,18 @@ class _GFFloatingWidgetState extends State<GFFloatingWidget> {
3433 var screenHeight = MediaQuery .of (context).size.height;
3534 return Stack (
3635 children: < Widget > [
37- Container (
38- child: widget.body ?? Container (),
39- ),
36+ Container (
37+ child: widget.body ?? Container (),
38+ ),
4039 Positioned (
41- top: widget.horizontalPosition != null ? widget.horizontalPosition : 0 ,
42- left: widget.verticalPosition != null ? widget.verticalPosition : 0 ,
40+ top: widget.horizontalPosition != null
41+ ? widget.horizontalPosition
42+ : 0 ,
43+ left: widget.verticalPosition != null ? widget.verticalPosition : 0 ,
4344 child: Container (
4445 width: MediaQuery .of (context).size.width,
45- child: widget.child ?? Container (),
46- )
47- ),
46+ child: widget.child ?? Container (),
47+ )),
4848 ],
4949 );
5050 }
0 commit comments