1.0.0
This commit is contained in:
54
example/lib/presentation/widgets/chart_holder.dart
Normal file
54
example/lib/presentation/widgets/chart_holder.dart
Normal file
@@ -0,0 +1,54 @@
|
||||
import 'package:fl_chart_app/presentation/resources/app_resources.dart';
|
||||
import 'package:fl_chart_app/presentation/samples/chart_sample.dart';
|
||||
import 'package:fl_chart_app/util/app_utils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class ChartHolder extends StatelessWidget {
|
||||
final ChartSample chartSample;
|
||||
|
||||
const ChartHolder({
|
||||
super.key,
|
||||
required this.chartSample,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
const SizedBox(width: 6),
|
||||
Text(
|
||||
chartSample.name,
|
||||
style: const TextStyle(
|
||||
color: AppColors.primary,
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
Expanded(child: Container()),
|
||||
IconButton(
|
||||
onPressed: () => AppUtils().tryToLaunchUrl(chartSample.url),
|
||||
icon: const Icon(
|
||||
Icons.code,
|
||||
color: AppColors.primary,
|
||||
),
|
||||
tooltip: 'Source code',
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 2),
|
||||
Container(
|
||||
decoration: const BoxDecoration(
|
||||
color: AppColors.itemsBackground,
|
||||
borderRadius:
|
||||
BorderRadius.all(Radius.circular(AppDimens.defaultRadius)),
|
||||
),
|
||||
child: chartSample.builder(context),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
import 'package:fl_chart_app/presentation/resources/app_colors.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class DownloadNativeAppButton extends StatelessWidget {
|
||||
const DownloadNativeAppButton({
|
||||
super.key,
|
||||
required this.onClose,
|
||||
required this.onDownload,
|
||||
});
|
||||
|
||||
final VoidCallback onClose;
|
||||
final VoidCallback onDownload;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.contentColorYellow,
|
||||
borderRadius: BorderRadius.circular(999),
|
||||
),
|
||||
child: Material(
|
||||
color: Colors.transparent,
|
||||
child: InkWell(
|
||||
borderRadius: BorderRadius.circular(999),
|
||||
onTap: onDownload,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 4,
|
||||
horizontal: 8,
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
const SizedBox(width: 4),
|
||||
const Icon(
|
||||
size: 28,
|
||||
Icons.download_for_offline,
|
||||
color: AppColors.contentColorBlack,
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
const Text(
|
||||
'Download Native App',
|
||||
style: TextStyle(
|
||||
color: AppColors.contentColorBlack,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w900,
|
||||
),
|
||||
),
|
||||
IconButton(
|
||||
onPressed: onClose,
|
||||
icon: const Icon(
|
||||
size: 16,
|
||||
Icons.close,
|
||||
color: AppColors.contentColorBlack,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
44
example/lib/presentation/widgets/indicator.dart
Normal file
44
example/lib/presentation/widgets/indicator.dart
Normal file
@@ -0,0 +1,44 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class Indicator extends StatelessWidget {
|
||||
const Indicator({
|
||||
super.key,
|
||||
required this.color,
|
||||
required this.text,
|
||||
required this.isSquare,
|
||||
this.size = 16,
|
||||
this.textColor,
|
||||
});
|
||||
final Color color;
|
||||
final String text;
|
||||
final bool isSquare;
|
||||
final double size;
|
||||
final Color? textColor;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: size,
|
||||
height: size,
|
||||
decoration: BoxDecoration(
|
||||
shape: isSquare ? BoxShape.rectangle : BoxShape.circle,
|
||||
color: color,
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 4,
|
||||
),
|
||||
Text(
|
||||
text,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: textColor,
|
||||
),
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
65
example/lib/presentation/widgets/legend_widget.dart
Normal file
65
example/lib/presentation/widgets/legend_widget.dart
Normal file
@@ -0,0 +1,65 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class LegendWidget extends StatelessWidget {
|
||||
const LegendWidget({
|
||||
super.key,
|
||||
required this.name,
|
||||
required this.color,
|
||||
});
|
||||
final String name;
|
||||
final Color color;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Container(
|
||||
width: 10,
|
||||
height: 10,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: color,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
Text(
|
||||
name,
|
||||
style: const TextStyle(
|
||||
color: Color(0xff757391),
|
||||
fontSize: 12,
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class LegendsListWidget extends StatelessWidget {
|
||||
const LegendsListWidget({
|
||||
super.key,
|
||||
required this.legends,
|
||||
});
|
||||
final List<Legend> legends;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Wrap(
|
||||
spacing: 16,
|
||||
children: legends
|
||||
.map(
|
||||
(e) => LegendWidget(
|
||||
name: e.name,
|
||||
color: e.color,
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class Legend {
|
||||
Legend(this.name, this.color);
|
||||
final String name;
|
||||
final Color color;
|
||||
}
|
||||
Reference in New Issue
Block a user