-
-
Notifications
You must be signed in to change notification settings - Fork 415
Expand file tree
/
Copy pathwidget_background.dart
More file actions
118 lines (109 loc) · 2.8 KB
/
widget_background.dart
File metadata and controls
118 lines (109 loc) · 2.8 KB
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
import 'package:flutter/material.dart';
import 'package:flutter_neumorphic/flutter_neumorphic.dart';
import '../../lib/Code.dart';
import '../../lib/ThemeConfigurator.dart';
import '../../lib/top_bar.dart';
class BackgroundWidgetPage extends StatefulWidget {
BackgroundWidgetPage({Key key}) : super(key: key);
@override
createState() => _WidgetPageState();
}
class _WidgetPageState extends State<BackgroundWidgetPage> {
@override
Widget build(BuildContext context) {
return NeumorphicTheme(
themeMode: ThemeMode.light,
theme: NeumorphicThemeData(
lightSource: LightSource.topLeft,
accentColor: NeumorphicColors.accent,
depth: 4,
intensity: 0.5,
),
child: _Page(),
);
}
}
class _Page extends StatefulWidget {
@override
createState() => _PageState();
}
class _PageState extends State<_Page> {
@override
Widget build(BuildContext context) {
return NeumorphicBackground(
padding: EdgeInsets.all(8),
child: Scaffold(
appBar: TopBar(
title: "Background",
actions: <Widget>[
ThemeConfigurator(),
],
),
backgroundColor: Colors.transparent,
body: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
mainAxisAlignment: MainAxisAlignment.start,
mainAxisSize: MainAxisSize.max,
children: [
_DefaultWidget(),
SizedBox(height: 30),
],
),
),
),
);
}
}
class _DefaultWidget extends StatefulWidget {
@override
createState() => _DefaultWidgetState();
}
class _DefaultWidgetState extends State<_DefaultWidget> {
Widget _buildCode(BuildContext context) {
return Code("""
//takes the themee baseColor as background
Expanded(
child: NeumorphicBackground(
child: ...
),
),
""");
}
Widget _buildWidget(BuildContext context) {
return Padding(
padding: EdgeInsets.all(12),
child: Row(
children: <Widget>[
Text(
"Default\n(inside black)",
style: TextStyle(color: NeumorphicTheme.defaultTextColor(context)),
),
SizedBox(width: 12),
Expanded(
child: Container(
padding: EdgeInsets.all(8),
color: Colors.black,
child: NeumorphicBackground(
child: const SizedBox(
width: 100,
height: 100,
),
),
),
),
SizedBox(width: 12),
],
),
);
}
Widget build(BuildContext context) {
return Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
_buildWidget(context),
_buildCode(context),
],
);
}
}