【FLUTTER ANDROID STUDIO and IOS】Draw Graph

 import 'package:draw_graph/draw_graph.dart';

import 'package:draw_graph/models/feature.dart';

import 'package:flutter/material.dart';

void main() {
runApp(MyApp());
}

class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
// This is the theme of your application.
//
// Try running your application with "flutter run". You'll see the
// application has a blue toolbar. Then, without quitting the app, try
// changing the primarySwatch below to Colors.green and then invoke
// "hot reload" (press "r" in the console where you ran "flutter run",
// or simply save your changes to "hot reload" in a Flutter IDE).
// Notice that the counter didn't reset back to zero; the application
// is not restarted.
primarySwatch: Colors.blue,
// This makes the visual density adapt to the platform that you run
// the app on. For desktop platforms, the controls will be smaller and
// closer together (more dense) than on mobile platforms.
visualDensity: VisualDensity.adaptivePlatformDensity,
),
home: GraphScreen(),
);
}
}
class GraphScreen extends StatefulWidget {
@override
_GraphScreenState createState() => _GraphScreenState();
}

class _GraphScreenState extends State<GraphScreen> {
final List<Feature> features = [
Feature(
title: "Flutter",
color: Colors.blue,
data: [0.3, 0.6, 0.8, 0.9, 1, 1.2],
),
Feature(
title: "Kotlin",
color: Colors.black,
data: [1, 0.8, 0.6, 0.7, 0.3, 0.1],
),
Feature(
title: "Java",
color: Colors.orange,
data: [0.4, 0.2, 0.9, 0.5, 0.6, 0.4],
),
Feature(
title: "React Native",
color: Colors.red,
data: [0.5, 0.2, 0, 0.3, 1, 1.3],
),
Feature(
title: "Swift",
color: Colors.green,
data: [0.25, 0.6, 1, 0.5, 0.8, 1, 4],
),
];

@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white54,
appBar: AppBar(
title: Text("Flutter Draw Graph Demo"),
automaticallyImplyLeading: false,
),
body: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.center,

children: <Widget>[
Padding(
padding: const EdgeInsets.symmetric(vertical: 1.0),
child: Text(
"Tasks Management",
style: TextStyle(
fontSize: 28,
fontWeight: FontWeight.bold,
letterSpacing: 2,
),
),
),
LineGraph(
features: features,
size: Size(420, 450),
labelX: ['Day 1', 'Day 2', 'Day 3', 'Day 4', 'Day 5', 'Day 6'],
labelY: ['25%', '45%', '65%', '75%', '85%', '100%'],
showDescription: true,
graphColor: Colors.black87,
),

],
),
);
}
}

No comments:

Renowned Water Expert Reynold Aquino Offers Exclusive Water Softener Discounts

Los Angeles, California - November 21, 2024 - World-renowned water expert Reynold Aquino is excited to announce exclusive discounts on prem...

Contact Form

Name

Email *

Message *