Skip to content

Commit

Permalink
update button widget
Browse files Browse the repository at this point in the history
fix binding, global & home module
  • Loading branch information
Fabio-web committed Jan 27, 2022
1 parent e6d5794 commit 809dbc0
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 32 deletions.
8 changes: 1 addition & 7 deletions lib/app/modules/global/binding.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@


import 'package:get/get.dart';
import 'package:speed_test_app/app/data/providers/speedtest/storage_provider.dart';
import 'package:speed_test_app/app/data/services/storage/repository.dart';
import 'package:speed_test_app/app/modules/home/controller.dart';
import 'package:speed_test_app/app/modules/global/controller.dart';
import 'package:speed_test_app/app/modules/settings/controller.dart';
Expand All @@ -12,9 +8,7 @@ class GlobalBinding implements Bindings {
@override
void dependencies() {
Get.lazyPut<GlobalController>(() => GlobalController());
Get.lazyPut<HomeController>(() => HomeController(
speedtestRepository: SpeedtestRepository(
speedtestStorageProvider: SpeedtestStorageProvider())));
Get.lazyPut<HomeController>(() => HomeController());
Get.lazyPut<SettingsController>(() => SettingsController());
}

Expand Down
19 changes: 0 additions & 19 deletions lib/app/modules/home/binding.dart

This file was deleted.

10 changes: 8 additions & 2 deletions lib/app/modules/settings/controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import 'package:get/get.dart';
class Location {
late final latitude = 0.0.obs;
late final longitude = 0.0.obs;
late final city = "".obs;
}

class SettingsController extends GetxController {
Expand All @@ -27,6 +28,7 @@ class SettingsController extends GetxController {
nameServer.value = value.as?.name ?? "undefined";
location.longitude.value = value.location?.lng ?? 0;
location.latitude.value = value.location?.lat ?? 0;
location.city.value = value.location?.city ?? "Somewhere";
});
}

Expand All @@ -38,12 +40,16 @@ class SettingsController extends GetxController {
return nameServer.value;
}

double? getLocationLatitude() {
double getLocationLatitude() {
return location.latitude.value;
}

double? getLocationLongitude() {
double getLocationLongitude() {
return location.longitude.value;
}

String getLocationCity() {
return location.city.value;
}

}
8 changes: 4 additions & 4 deletions lib/app/widgets/button_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'package:flutter/material.dart';

class ButtonBuilder extends StatelessWidget {

final String text;
final String? text;
final BorderRadiusGeometry? borderRadius;
final BorderSide? border;
final double? width;
Expand Down Expand Up @@ -41,9 +41,9 @@ class ButtonBuilder extends StatelessWidget {
crossAxisAlignment: WrapCrossAlignment.center,
spacing: 15,
children: [
Text(text,
if(text != null) Text(text!,
textAlign: TextAlign.center,
style: style ?? const TextStyle(fontSize: 18, fontWeight: FontWeight.w700)
style: style ?? const TextStyle(fontSize: 20, fontWeight: FontWeight.w300)
),
if(icon != null) Icon(icon, size: 22),
],
Expand All @@ -54,7 +54,7 @@ class ButtonBuilder extends StatelessWidget {
primary: color ?? Colors.white,
side: border,
shape: RoundedRectangleBorder(
borderRadius: borderRadius ?? BorderRadius.circular(16),
borderRadius: borderRadius ?? BorderRadius.circular(50),
)
),
);
Expand Down

0 comments on commit 809dbc0

Please sign in to comment.