188 lines
5 KiB
Dart
188 lines
5 KiB
Dart
// ignore_for_file: prefer_const_constructors, prefer_const_literals_to_create_immutables
|
|
|
|
import 'package:fl_chart/fl_chart.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:skyforce_app/url_strategy_native.dart'
|
|
if (dart.library.html) 'package:skyforce_app/url_strategy_web.dart.dart';
|
|
// import 'package:url_launcher/url_launcher.dart';
|
|
import 'color_schemes.g.dart';
|
|
|
|
void main() {
|
|
runApp(const MainApp());
|
|
urlConfig();
|
|
}
|
|
|
|
class MainApp extends StatelessWidget {
|
|
const MainApp({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return MaterialApp(
|
|
theme: ThemeData(useMaterial3: true, colorScheme: lightColorScheme),
|
|
darkTheme: ThemeData(useMaterial3: true, colorScheme: darkColorScheme),
|
|
initialRoute: '/',
|
|
routes: {
|
|
'/': (context) => const Home(),
|
|
},
|
|
// debugShowCheckedModeBanner: false,
|
|
);
|
|
}
|
|
}
|
|
|
|
class Home extends StatefulWidget {
|
|
const Home({super.key});
|
|
|
|
@override
|
|
State<Home> createState() => _HomeState();
|
|
}
|
|
|
|
class _HomeState extends State<Home> {
|
|
bool _isLoading = false;
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
dataLoadFunction();
|
|
}
|
|
|
|
dataLoadFunction() async {
|
|
setState(() {
|
|
_isLoading = true;
|
|
});
|
|
await Future.delayed(const Duration(seconds: 5));
|
|
setState(() {
|
|
_isLoading = false;
|
|
});
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
backgroundColor: Color.fromARGB(255, 1, 0, 56),
|
|
title: const Text('SkyForce'),
|
|
),
|
|
body: _isLoading
|
|
? const Loading()
|
|
: Loaded()
|
|
);
|
|
}
|
|
}
|
|
|
|
class Loading extends StatelessWidget {
|
|
const Loading({
|
|
super.key,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Column(
|
|
children: [
|
|
SizedBox(
|
|
height: MediaQuery.of(context).size.height / 2,
|
|
),
|
|
Align(
|
|
child: CircularProgressIndicator(),
|
|
),
|
|
Align(
|
|
child: Text('Loading...'),
|
|
),
|
|
SizedBox(
|
|
height: MediaQuery.of(context).size.height / 2 - 100,
|
|
),
|
|
Align(
|
|
child: Text('Powered by Thunder Network'),
|
|
)
|
|
],
|
|
);
|
|
}
|
|
}
|
|
|
|
class Loaded extends StatelessWidget {
|
|
const Loaded({
|
|
super.key,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return SingleChildScrollView(
|
|
child: Center(
|
|
child: Column(
|
|
children: [
|
|
Wrap(
|
|
children: [
|
|
Padding(
|
|
padding: const EdgeInsets.all(16.0),
|
|
child: Container(
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(40),
|
|
color: Color.fromARGB(255, 44, 44, 44),
|
|
),
|
|
height: 300,
|
|
width: 300,
|
|
child: PieChart(
|
|
PieChartData(
|
|
sections: [
|
|
PieChartSectionData(
|
|
value: 30,
|
|
color: Colors.red,
|
|
title: 'Red',
|
|
),
|
|
PieChartSectionData(
|
|
value: 20,
|
|
color: Colors.blue,
|
|
title: 'Blue',
|
|
),
|
|
],
|
|
),
|
|
)
|
|
),
|
|
),
|
|
Padding(
|
|
padding: const EdgeInsets.all(16.0),
|
|
child: Container(
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(40),
|
|
color: Color.fromARGB(255, 44, 44, 44),
|
|
),
|
|
height: 300,
|
|
width: 300,
|
|
child: LineChart(
|
|
LineChartData(
|
|
lineBarsData: [
|
|
LineChartBarData(
|
|
spots: [
|
|
FlSpot(0, 1),
|
|
FlSpot(1, 3),
|
|
FlSpot(2, 2),
|
|
FlSpot(3, 5),
|
|
FlSpot(4, 4),
|
|
FlSpot(5, 6),
|
|
],
|
|
),
|
|
LineChartBarData(
|
|
color: Colors.red,
|
|
spots: [
|
|
FlSpot(0, 0),
|
|
FlSpot(1, 1),
|
|
FlSpot(2, 2),
|
|
FlSpot(3, 3),
|
|
FlSpot(4, 4),
|
|
FlSpot(5, 5),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
duration: Duration(milliseconds: 150),
|
|
curve: Curves.linear,
|
|
)
|
|
),
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|