Line data Source code
1 : import 'package:dotted_border/dotted_border.dart';
2 : import 'package:flutter/material.dart';
3 : import 'package:flutter/widgets.dart';
4 : import 'package:pal/src/theme.dart';
5 : import 'package:pal/src/ui/shared/widgets/circle_button.dart';
6 :
7 : class EditableBackground extends StatelessWidget {
8 : final Color backgroundColor;
9 : final Function() onColorChange;
10 : final Widget widget;
11 : final String circleIconKey;
12 :
13 2 : const EditableBackground({
14 : Key key,
15 : @required this.backgroundColor,
16 : @required this.onColorChange,
17 : @required this.widget,
18 : @required this.circleIconKey,
19 2 : }) : super(key: key);
20 :
21 2 : @override
22 : Widget build(BuildContext context) {
23 2 : return Container(
24 : width: double.infinity,
25 2 : color: backgroundColor,
26 2 : child: Padding(
27 : padding: const EdgeInsets.all(2.0),
28 2 : child: DottedBorder(
29 : strokeWidth: 2.0,
30 : strokeCap: StrokeCap.round,
31 2 : dashPattern: [10, 7],
32 2 : color: Colors.white.withAlpha(80),
33 2 : child: Stack(
34 : fit: StackFit.expand,
35 2 : children: [
36 2 : widget,
37 2 : Positioned(
38 : top: 20.0,
39 : left: 20.0,
40 2 : child: SafeArea(
41 2 : child: CircleIconButton(
42 4 : key: ValueKey(circleIconKey),
43 2 : icon: Icon(Icons.invert_colors),
44 6 : backgroundColor: PalTheme.of(context).colors.light,
45 2 : onTapCallback: onColorChange,
46 : ),
47 : ),
48 : ),
49 : ],
50 : ),
51 : ),
52 : ),
53 : );
54 : }
55 : }
|