-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
+ syncfusion_flutter_gauges package
- Loading branch information
Showing
9 changed files
with
284 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import 'package:get/get.dart'; | ||
import 'package:speed_test_app/app/modules/speedtest/controller.dart'; | ||
|
||
class SpeedtestBinding implements Bindings { | ||
|
||
@override | ||
void dependencies() { | ||
Get.lazyPut<SpeedtestController>(() => SpeedtestController()); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import 'package:get/get.dart'; | ||
|
||
class SpeedtestController extends GetxController { | ||
|
||
final isStarted = false.obs; | ||
|
||
final transferRate = 0.0.obs; | ||
|
||
SpeedtestController(); | ||
|
||
void changeTransferRate(double value) { | ||
transferRate.value = value; | ||
} | ||
|
||
void launchTest() { | ||
isStarted.value = true; | ||
changeTransferRate(73.5); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:get/get.dart'; | ||
import 'package:speed_test_app/app/core/values/colors.dart'; | ||
import 'package:speed_test_app/app/core/values/sizes.dart'; | ||
import 'package:speed_test_app/app/modules/home/widgets/text_info.dart'; | ||
import 'package:speed_test_app/app/modules/home/widgets/top_app_bar.dart'; | ||
import 'package:speed_test_app/app/modules/settings/controller.dart'; | ||
import 'package:speed_test_app/app/modules/speedtest/controller.dart'; | ||
import 'package:speed_test_app/app/core/utils/extension.dart'; | ||
import 'package:speed_test_app/app/modules/speedtest/widgets/build_gauge.dart'; | ||
import 'package:speed_test_app/app/modules/speedtest/widgets/network_info.dart'; | ||
import 'package:speed_test_app/app/widgets/button_builder.dart'; | ||
|
||
class SpeedtestPage extends GetView<SpeedtestController> { | ||
|
||
final settingsController = Get.find<SettingsController>(); | ||
|
||
SpeedtestPage({Key? key}) : super(key: key); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Scaffold( | ||
body: SingleChildScrollView( | ||
child: SafeArea( | ||
child: Column( | ||
children: [ | ||
TopAppBar( | ||
title: "Speedtest", | ||
divider: false, | ||
icon: GestureDetector( | ||
onTap: () => Get.back(), | ||
child: const Icon(Icons.close), | ||
) | ||
), | ||
Padding( | ||
padding: container, | ||
child: Container( | ||
padding: EdgeInsets.all(5.0.wp), | ||
decoration: BoxDecoration( | ||
color: secondary, | ||
borderRadius: BorderRadius.circular(6) | ||
), | ||
child: Row( | ||
mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
children: [ | ||
//language | ||
NetworkInfo( | ||
icon: const Icon(Icons.router_outlined, color: Colors.white, size: 35), | ||
color: accent, | ||
label: "Server", | ||
value: settingsController.getNameServer() | ||
), | ||
NetworkInfo( | ||
icon: const Icon(Icons.router_outlined, color: Colors.white, size: 35), | ||
label: "Location", | ||
value: settingsController.getLocationCity() | ||
) | ||
], | ||
), | ||
), | ||
), | ||
SizedBox(height: 5.0.wp), | ||
BuildGauge(), | ||
SizedBox(height: 5.0.wp), | ||
Obx(() => Padding( | ||
padding: container, | ||
child: controller.isStarted.value ? | ||
Row( | ||
mainAxisAlignment: MainAxisAlignment.spaceAround, | ||
children: [ | ||
Wrap( | ||
spacing: 3.0.wp, | ||
children: [ | ||
const Icon(Icons.south_outlined), | ||
TextInfo(label: "Download", text: "${controller.transferRate.value} Mbps"), | ||
], | ||
), | ||
Wrap( | ||
spacing: 3.0.wp, | ||
children: [ | ||
const Icon(Icons.north_outlined), | ||
TextInfo(label: "Upload", text: "${controller.transferRate.value-7.6} Mbps") | ||
], | ||
) | ||
], | ||
) | ||
: ButtonBuilder("Start Test", | ||
onPressed: () => controller.launchTest(), | ||
width: 35.0.wp, | ||
paddingVertical: 2.0.wp, | ||
backgroundColor: Colors.white, | ||
color: primary, | ||
border: const BorderSide(color: primary, width: 2), | ||
), | ||
)), | ||
SizedBox(height: 10.0.wp), | ||
Padding( | ||
padding: container, | ||
child: Column( | ||
children: [ | ||
Text("Speedtest Global", style: TextStyle(fontSize: 14.0.sp, fontWeight: FontWeight.bold)), | ||
SizedBox(height: 2.0.wp), | ||
Text("Fint out how your country's internet ranks on\n the Speedtest Global", | ||
style: TextStyle(fontSize: 10.0.sp, color: Colors.grey), textAlign: TextAlign.center), | ||
SizedBox(height: 5.0.wp), | ||
ButtonBuilder("See Ranking") | ||
], | ||
), | ||
), | ||
SizedBox(height: 10.0.wp), | ||
], | ||
), | ||
), | ||
), | ||
); | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:get/get.dart'; | ||
import 'package:speed_test_app/app/core/values/colors.dart'; | ||
import 'package:speed_test_app/app/modules/speedtest/controller.dart'; | ||
import 'package:syncfusion_flutter_gauges/gauges.dart'; | ||
|
||
class BuildGauge extends StatelessWidget { | ||
|
||
final speedtestController = Get.find<SpeedtestController>(); | ||
|
||
BuildGauge({Key? key}) : super(key: key); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Obx(() => SfRadialGauge( | ||
key: UniqueKey(), | ||
axes: [ | ||
RadialAxis( | ||
showLabels: false, | ||
showTicks: false, | ||
axisLineStyle: AxisLineStyle( | ||
thickness: 40, | ||
color: Colors.grey[300] | ||
), | ||
), | ||
RadialAxis( | ||
pointers: [ | ||
NeedlePointer( | ||
value: speedtestController.transferRate.value, | ||
knobStyle: const KnobStyle( | ||
knobRadius: 0.041 | ||
), | ||
needleEndWidth: 7, | ||
needleLength: 0.4, | ||
enableAnimation: true, | ||
), | ||
const NeedlePointer( | ||
knobStyle: KnobStyle( | ||
color: Colors.white, | ||
knobRadius: 0.015 | ||
), | ||
needleLength: 0, | ||
), | ||
RangePointer( | ||
value: speedtestController.transferRate.value, | ||
color: primary, | ||
width: 50, | ||
enableAnimation: true, | ||
) | ||
], | ||
showTicks: false, | ||
axisLabelStyle: const GaugeTextStyle( | ||
color: Colors.grey, | ||
fontSize: 14, | ||
), | ||
labelOffset: 25, | ||
axisLineStyle: const AxisLineStyle( | ||
thickness: 50, | ||
color: Colors.transparent | ||
), | ||
), | ||
], | ||
)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:speed_test_app/app/core/values/colors.dart'; | ||
import 'package:speed_test_app/app/core/utils/extension.dart'; | ||
|
||
class NetworkInfo extends StatelessWidget { | ||
|
||
final Icon icon; | ||
final Color color; | ||
final String label; | ||
final String value; | ||
|
||
const NetworkInfo({Key? key, | ||
required this.icon, | ||
this.color = primary, | ||
required this.label, | ||
required this.value | ||
}) : super(key: key); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Wrap( | ||
spacing: 4.0.wp, | ||
crossAxisAlignment: WrapCrossAlignment.center, | ||
children: [ | ||
Container( | ||
padding: EdgeInsets.all(2.0.wp), | ||
decoration: BoxDecoration(color: color, borderRadius: BorderRadius.circular(50)), | ||
child: icon, | ||
), | ||
Column( | ||
crossAxisAlignment: CrossAxisAlignment.start, | ||
mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
children: [ | ||
Text(label, style: TextStyle(color: Colors.grey, fontSize: 10.0.sp)), | ||
SizedBox(height: 1.0.wp), | ||
ConstrainedBox( | ||
constraints: const BoxConstraints(maxWidth: 90), | ||
child: Text(value, maxLines: 1, softWrap: false, | ||
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 12.0.sp, overflow: TextOverflow.fade)), | ||
), | ||
], | ||
) | ||
], | ||
); | ||
} | ||
} |
Oops, something went wrong.