Skip to content

Commit ad3ea84

Browse files
New samples committed
1 parent a5260a1 commit ad3ea84

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+15176
-0
lines changed

lib/samples/barcodes/one_dimensional/one_dimensional.dart

Lines changed: 1155 additions & 0 deletions
Large diffs are not rendered by default.

lib/samples/barcodes/two_dimensional/qr_code.dart

Lines changed: 444 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 240 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,240 @@
1+
import 'package:intl/intl.dart';
2+
import 'package:flutter_examples/widgets/bottom_sheet.dart';
3+
import 'package:scoped_model/scoped_model.dart';
4+
import 'package:flutter_examples/widgets/checkbox.dart';
5+
import 'package:syncfusion_flutter_charts/charts.dart';
6+
import 'package:flutter/material.dart';
7+
import '../../../../model/helper.dart';
8+
import '../../../../model/model.dart';
9+
10+
//ignore: must_be_immutable
11+
class CandleChart extends StatefulWidget {
12+
CandleChart({this.sample, Key key}) : super(key: key);
13+
SubItem sample;
14+
15+
@override
16+
_CandleChartState createState() =>
17+
_CandleChartState(sample);
18+
}
19+
20+
class _CandleChartState extends State<CandleChart> {
21+
_CandleChartState(this.sample);
22+
final SubItem sample;
23+
24+
@override
25+
Widget build(BuildContext context) {
26+
return getScopedModel(null, sample, CandleFrontPanel(sample));
27+
}
28+
}
29+
30+
31+
32+
SfCartesianChart getCandle(bool isTileView,[bool enableSolidCandle]) {
33+
return SfCartesianChart(
34+
plotAreaBorderWidth: 0,
35+
title: ChartTitle(text: isTileView ? '' : 'AAPL - 2016'),
36+
primaryXAxis: DateTimeAxis(
37+
dateFormat: DateFormat.MMM(),
38+
interval: 3,
39+
intervalType: DateTimeIntervalType.months,
40+
minimum: DateTime(2016,01,01),
41+
maximum: DateTime(2016,10,01),
42+
majorGridLines: MajorGridLines(width: 0)
43+
),
44+
primaryYAxis: NumericAxis(
45+
minimum: 140,
46+
maximum: 60,
47+
interval: 20,
48+
labelFormat: '\${value}',
49+
axisLine: AxisLine(width: 0)),
50+
series: getCandleSeries(isTileView,enableSolidCandle),
51+
trackballBehavior: TrackballBehavior(enable: true, activationMode: ActivationMode.singleTap),
52+
);
53+
}
54+
55+
List<CandleSeries<ChartSampleData, DateTime>> getCandleSeries(
56+
bool isTileView,[bool enableSolidCandle]) {
57+
final List<ChartSampleData> chartData = <ChartSampleData>[
58+
ChartSampleData(x:DateTime(2016,01,11), open:98.97, yValue:101.19, y:95.36, close:97.13),
59+
ChartSampleData(x:DateTime(2016,01,18), open:98.41, yValue:101.46, y:93.42, close:101.42),
60+
ChartSampleData(x:DateTime(2016,01,25), open:101.52, yValue:101.53, y:92.39, close:97.34),
61+
ChartSampleData(x:DateTime(2016,02,01), open:96.47, yValue:97.33, y:93.69, close:94.02),
62+
ChartSampleData(x:DateTime(2016,02,08), open:93.13, yValue:96.35, y:92.59, close:93.99),
63+
ChartSampleData(x:DateTime(2016,02,15), open:95.02, yValue:98.89, y:94.61, close:96.04),
64+
ChartSampleData(x:DateTime(2016,02,22), open:96.31, yValue:98.0237, y:93.32, close:96.91),
65+
ChartSampleData(x:DateTime(2016,02,29), open:96.86, yValue:103.75, y:96.65, close:103.01),
66+
ChartSampleData(x:DateTime(2016,03,07), open:102.39, yValue:102.83, y:100.15, close:102.26),
67+
ChartSampleData(x:DateTime(2016,03,14), open:101.91, yValue:106.5, y:101.78, close:105.92),
68+
ChartSampleData(x:DateTime(2016,03,21), open:105.93, yValue:107.65, y:104.89, close:105.67),
69+
ChartSampleData(x:DateTime(2016,03,28), open:106, yValue:110.42, y:104.88, close:109.99),
70+
ChartSampleData(x:DateTime(2016,04,04), open:110.42, yValue:112.19, y:108.121, close:108.66),
71+
ChartSampleData(x:DateTime(2016,04,11), open:108.97, yValue:112.39, y:108.66, close:109.85),
72+
ChartSampleData(x:DateTime(2016,04,18), open:108.89, yValue:108.95, y:104.62, close:105.68),
73+
ChartSampleData(x:DateTime(2016,04,25), open:105, yValue:105.65, y:92.51, close:93.74),
74+
ChartSampleData(x:DateTime(2016,05,02), open:93.965, yValue:95.9, y:91.85, close:92.72),
75+
ChartSampleData(x:DateTime(2016,05,09), open:93, yValue:93.77, y:89.47, close:90.52),
76+
ChartSampleData(x:DateTime(2016,05,16), open:92.39, yValue:95.43, y:91.65, close:95.22),
77+
ChartSampleData(x:DateTime(2016,05,23), open:95.87, yValue:100.73, y:95.67, close:100.35),
78+
ChartSampleData(x:DateTime(2016,05,30), open:99.6, yValue:100.4, y:96.63, close:97.92),
79+
ChartSampleData(x:DateTime(2016,06,06), open:97.99, yValue:101.89, y:97.55, close:98.83),
80+
ChartSampleData(x:DateTime(2016,06,13), open:98.69, yValue:99.12, y:95.3, close:95.33),
81+
ChartSampleData(x:DateTime(2016,06,20), open:96, yValue:96.89, y:92.65, close:93.4),
82+
ChartSampleData(x:DateTime(2016,06,27), open:93, yValue:96.465, y:91.5, close:95.89),
83+
ChartSampleData(x:DateTime(2016,07,04), open:95.39, yValue:96.89, y:94.37, close:96.68),
84+
ChartSampleData(x:DateTime(2016,07,11), open:96.75, yValue:99.3, y:96.73, close:98.78),
85+
ChartSampleData(x:DateTime(2016,07,18), open:98.7, yValue:101, y:98.31, close:98.66),
86+
ChartSampleData(x:DateTime(2016,07,25), open:98.25, yValue:104.55, y:96.42, close:104.21),
87+
ChartSampleData(x:DateTime(2016,08,01), open:104.41, yValue:107.65, y:104, close:107.48),
88+
ChartSampleData(x:DateTime(2016,08,08), open:107.52, yValue:108.94, y:107.16, close:108.18),
89+
ChartSampleData(x:DateTime(2016,08,15), open:108.14, yValue:110.23, y:108.08, close:109.36),
90+
ChartSampleData(x:DateTime(2016,08,22), open:108.86, yValue:109.32, y:106.31, close:106.94),
91+
ChartSampleData(x:DateTime(2016,08,29), open:106.62, yValue:108, y:105.5, close:107.73),
92+
ChartSampleData(x:DateTime(2016,09,05), open:107.9, yValue:108.76, y:103.13, close:103.13),
93+
ChartSampleData(x:DateTime(2016,09,12), open:102.65, yValue:116.13, y:102.53, close:114.92),
94+
ChartSampleData(x:DateTime(2016,09,19), open:115.19, yValue:116.18, y:111.55, close:112.71),
95+
ChartSampleData(x:DateTime(2016,09,26), open:111.64, yValue:114.64, y:111.55, close:113.05),
96+
];
97+
return <CandleSeries<ChartSampleData, DateTime>>[
98+
CandleSeries<ChartSampleData, DateTime>(
99+
enableTooltip: true,
100+
enableSolidCandles: enableSolidCandle,
101+
dataSource: chartData,
102+
name: 'AAPL',
103+
xValueMapper: (ChartSampleData sales, _) => sales.x,
104+
lowValueMapper: (ChartSampleData sales, _) => sales.y,
105+
highValueMapper: (ChartSampleData sales, _) => sales.yValue,
106+
openValueMapper: (ChartSampleData sales, _) => sales.open,
107+
closeValueMapper: (ChartSampleData sales, _) => sales.close,
108+
dataLabelSettings: DataLabelSettings(
109+
isVisible: false))
110+
];
111+
}
112+
class CandleFrontPanel extends StatefulWidget {
113+
//ignore: prefer_const_constructors_in_immutables
114+
CandleFrontPanel(this.subItemList);
115+
116+
final SubItem subItemList;
117+
118+
@override
119+
_CandleFrontPanelState createState() =>
120+
_CandleFrontPanelState(subItemList);
121+
}
122+
123+
class _CandleFrontPanelState
124+
extends State<CandleFrontPanel> {
125+
_CandleFrontPanelState(this.sample);
126+
final SubItem sample;
127+
bool enableSolidCandle = false;
128+
129+
@override
130+
void initState() {
131+
enableSolidCandle = false;
132+
super.initState();
133+
}
134+
135+
@override
136+
Widget build(BuildContext context) {
137+
return ScopedModelDescendant<SampleModel>(
138+
rebuildOnChange: true,
139+
builder: (BuildContext context, _, SampleModel model) {
140+
return Scaffold(
141+
backgroundColor: model.cardThemeColor,
142+
body: Padding(
143+
padding: const EdgeInsets.fromLTRB(5, 0, 5, 60),
144+
child: Container(
145+
child: getCandle(false,enableSolidCandle)),
146+
),
147+
floatingActionButton: FloatingActionButton(
148+
onPressed: () {
149+
_showSettingsPanel(model);
150+
},
151+
child: Icon(Icons.graphic_eq, color: Colors.white),
152+
backgroundColor: model.backgroundColor,
153+
));
154+
});
155+
}
156+
157+
void _showSettingsPanel(SampleModel model) {
158+
final double height =
159+
(MediaQuery.of(context).size.height > MediaQuery.of(context).size.width)
160+
? 0.3
161+
: 0.4;
162+
showRoundedModalBottomSheet<dynamic>(
163+
dismissOnTap: false,
164+
context: context,
165+
radius: 12.0,
166+
color: model.bottomSheetBackgroundColor,
167+
builder: (BuildContext context) => ScopedModelDescendant<SampleModel>(
168+
rebuildOnChange: false,
169+
builder: (BuildContext context, _, SampleModel model) => Padding(
170+
padding: const EdgeInsets.fromLTRB(0, 0, 0, 0),
171+
child: Container(
172+
height: 180,
173+
child: Padding(
174+
padding: const EdgeInsets.fromLTRB(0, 0, 0, 0),
175+
child: Container(
176+
height: MediaQuery.of(context).size.height * height,
177+
child: Padding(
178+
padding: const EdgeInsets.fromLTRB(15, 0, 0, 5),
179+
child: Stack(children: <Widget>[
180+
Container(
181+
height: 40,
182+
child: Row(
183+
crossAxisAlignment:
184+
CrossAxisAlignment.center,
185+
mainAxisAlignment:
186+
MainAxisAlignment.spaceBetween,
187+
children: <Widget>[
188+
Text('Settings',
189+
style: TextStyle(
190+
color: model.textColor,
191+
fontSize: 18,
192+
letterSpacing: 0.34,
193+
fontWeight: FontWeight.w500)),
194+
IconButton(
195+
icon: Icon(
196+
Icons.close,
197+
color: model.textColor,
198+
),
199+
onPressed: () {
200+
Navigator.pop(context);
201+
},
202+
),
203+
],
204+
),
205+
),
206+
Padding(
207+
padding:
208+
const EdgeInsets.fromLTRB(30, 50, 0, 0),
209+
child: ListView(
210+
children: <Widget>[
211+
Container(
212+
child: Row(
213+
children: <Widget>[
214+
Text('Enable solid candles',
215+
style: TextStyle(
216+
color: model.textColor,
217+
fontSize: 16,
218+
letterSpacing: 0.34,
219+
fontWeight:
220+
FontWeight.normal)),
221+
BottomSheetCheckbox(
222+
activeColor:
223+
model.backgroundColor,
224+
switchValue: enableSolidCandle,
225+
valueChanged: (dynamic value) {
226+
setState(() {
227+
enableSolidCandle = value;
228+
});
229+
},
230+
),
231+
],
232+
),
233+
),
234+
],
235+
),
236+
),
237+
]),
238+
)))))));
239+
}
240+
}
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
import 'package:intl/intl.dart';
2+
import 'package:syncfusion_flutter_charts/charts.dart';
3+
import 'package:flutter/material.dart';
4+
import '../../../../model/helper.dart';
5+
import '../../../../model/model.dart';
6+
7+
//ignore: must_be_immutable
8+
class HiloChart extends StatefulWidget {
9+
HiloChart({this.sample, Key key}) : super(key: key);
10+
SubItem sample;
11+
12+
@override
13+
_HiloChartState createState() =>
14+
_HiloChartState(sample);
15+
}
16+
17+
class _HiloChartState extends State<HiloChart> {
18+
_HiloChartState(this.sample);
19+
final SubItem sample;
20+
21+
@override
22+
Widget build(BuildContext context) {
23+
return getScopedModel(getHilo(false),sample);
24+
}
25+
}
26+
27+
28+
29+
SfCartesianChart getHilo(bool isTileView) {
30+
return SfCartesianChart(
31+
plotAreaBorderWidth: 0,
32+
title: ChartTitle(text: isTileView ? '' : 'AAPL - 2016'),
33+
primaryXAxis: DateTimeAxis(
34+
dateFormat: DateFormat.MMMd(),
35+
minimum:DateTime(2016,01,01),
36+
maximum:DateTime(2016,07,01),
37+
intervalType: DateTimeIntervalType.months,
38+
majorGridLines: MajorGridLines(width: 0)
39+
),
40+
primaryYAxis: NumericAxis(
41+
interval: 20,
42+
minimum: 140,
43+
maximum: 60,
44+
labelFormat: '\${value}',
45+
axisLine: AxisLine(width: 0)
46+
),
47+
series: getHiloSeries(isTileView),
48+
tooltipBehavior: TooltipBehavior(enable: true),
49+
);
50+
}
51+
52+
List<HiloSeries<ChartSampleData, DateTime>> getHiloSeries(
53+
bool isTileView) {
54+
final List<ChartSampleData> chartData = <ChartSampleData>[
55+
ChartSampleData(x:DateTime(2016,01,11), yValue2:98.97, yValue:101.19, y:95.36, yValue3:97.13),
56+
ChartSampleData(x:DateTime(2016,01,18), yValue2:98.41, yValue:101.46, y:93.42, yValue3:101.42),
57+
ChartSampleData(x:DateTime(2016,01,25), yValue2:101.52, yValue:101.53, y:92.39, yValue3:97.34),
58+
ChartSampleData(x:DateTime(2016,02,01), yValue2:96.47, yValue:97.33, y:93.69, yValue3:94.02),
59+
ChartSampleData(x:DateTime(2016,02,08), yValue2:93.13, yValue:96.35, y:92.59, yValue3:93.99),
60+
ChartSampleData(x:DateTime(2016,02,15), yValue2:95.02, yValue:98.89, y:94.61, yValue3:96.04),
61+
ChartSampleData(x:DateTime(2016,02,22), yValue2:96.31, yValue:98.0237, y:93.32, yValue3:96.91),
62+
ChartSampleData(x:DateTime(2016,02,29), yValue2:96.86, yValue:103.75, y:96.65, yValue3:103.01),
63+
ChartSampleData(x:DateTime(2016,03,07), yValue2:102.39, yValue:102.83, y:100.15, yValue3:102.26),
64+
ChartSampleData(x:DateTime(2016,03,14), yValue2:101.91, yValue:106.5, y:101.78, yValue3:105.92),
65+
ChartSampleData(x:DateTime(2016,03,21), yValue2:105.93, yValue:107.65, y:104.89, yValue3:105.67),
66+
ChartSampleData(x:DateTime(2016,03,28), yValue2:106, yValue:110.42, y:104.88, yValue3:109.99),
67+
ChartSampleData(x:DateTime(2016,04,04), yValue2:110.42, yValue:112.19, y:108.121, yValue3:108.66),
68+
ChartSampleData(x:DateTime(2016,04,11), yValue2:108.97, yValue:112.39, y:108.66, yValue3:109.85),
69+
ChartSampleData(x:DateTime(2016,04,18), yValue2:108.89, yValue:108.95, y:104.62, yValue3:105.68),
70+
ChartSampleData(x:DateTime(2016,04,25), yValue2:105, yValue:105.65, y:92.51, yValue3:93.74),
71+
ChartSampleData(x:DateTime(2016,05,02), yValue2:93.965, yValue:95.9, y:91.85, yValue3:92.72),
72+
ChartSampleData(x:DateTime(2016,05,09), yValue2:93, yValue:93.77, y:89.47, yValue3:90.52),
73+
ChartSampleData(x:DateTime(2016,05,16), yValue2:92.39, yValue:95.43, y:91.65, yValue3:95.22),
74+
ChartSampleData(x:DateTime(2016,05,23), yValue2:95.87, yValue:100.73, y:95.67, yValue3:100.35),
75+
ChartSampleData(x:DateTime(2016,05,30), yValue2:99.6, yValue:100.4, y:96.63, yValue3:97.92),
76+
ChartSampleData(x:DateTime(2016,06,06), yValue2:97.99, yValue:101.89, y:97.55, yValue3:98.83),
77+
ChartSampleData(x:DateTime(2016,06,13), yValue2:98.69, yValue:99.12, y:95.3, yValue3:95.33),
78+
ChartSampleData(x:DateTime(2016,06,20), yValue2:96, yValue:96.89, y:92.65, yValue3:93.4),
79+
ChartSampleData(x:DateTime(2016,06,27), yValue2:93, yValue:96.465, y:91.5, yValue3:95.89),
80+
];
81+
return <HiloSeries<ChartSampleData, DateTime>>[
82+
HiloSeries<ChartSampleData, DateTime>(
83+
enableTooltip: true,
84+
dataSource: chartData,
85+
color: const Color.fromRGBO(192, 108, 132, 1),
86+
name: 'AAPL',
87+
xValueMapper: (ChartSampleData sales, _) => sales.x,
88+
lowValueMapper: (ChartSampleData sales, _) => sales.y,
89+
highValueMapper: (ChartSampleData sales, _) => sales.yValue,
90+
dataLabelSettings: DataLabelSettings(
91+
isVisible: false))
92+
];
93+
}

0 commit comments

Comments
 (0)