Skip to content

Instantly share code, notes, and snippets.

View VB10's full-sized avatar
🏠
Working from home

Veli Bacik VB10

🏠
Working from home
View GitHub Profile
class RouteManager implements IRouteManager {
@override
double calculateDistance(LatLng cordinate, LatLng secondCordinate) {
return (distanceBetween(
cordinate.latitude, cordinate.longitude, secondCordinate.latitude, secondCordinate.longitude))
.roundToDouble() /
1000;
}
}
class PointsCompleted extends PointsState {
final List<Coordinate> coordinates;
final int selectedItem;
PointsCompleted(this.coordinates, {this.selectedItem});
PointsCompleted copyWith({
List<Coordinate> coordinates,
int selectedItem,
Positioned positionedPageView(
BuildContext context, PointsCompleted completed) {
return Positioned(
height: context.dynamicHeight(0.12),
bottom: 0,
right: 0,
left: -context.dynamicWidth(0.1),
child: PageView.builder(
onPageChanged: (value) {
context
List<SingleChildWidget> providerItems = [ Provider.value(value: CustomMarkerManager())}]
class CustomMarkerManager extends CustomMarker {
Map<int, BitmapDescriptor> _markers = {};
Future<BitmapDescriptor> getCustomMarker({
int value,
Color clusterColor,
Color textColor,
int width,
Widget buildScaffoldBody() => Scaffold(
key: scaffoldKey,
body: BlocConsumer<PointsCubit, PointsState>(
listener: (context, state) {
if (state.runtimeType == PointsError) {
scaffoldKey.currentState
.showSnackBar(SnackBar(content: Text("Error")));
}
},
builder: (context, state) {
Future<void> initMapControllerMarkers(GoogleMapController controller,
BuildContext context, List<Coordinate> coordinates) async {
CustomMarkerManager markerManager = context.read<CustomMarkerManager>();
for (var i = 0; i < coordinates.length; i++) {
final icon = await markerManager.getCustomMarker(
value: i,
clusterColor: Colors.orange,
textColor: Colors.white,
width: _markersWidth);
abstract class LineState extends Equatable {
final GoogleMapController controller;
final int currentIndex;
LineState(this.controller, this.currentIndex);
}
class MapsMarkerChange extends LineState {
MapsMarkerChange(GoogleMapController controller, int currentIndex)
: super(controller, currentIndex);
abstract class IMapService {
final INetworkManager service;
final GlobalKey<ScaffoldState> scaffoldKey;
IMapService(this.service, this.scaffoldKey);
Future<List<Coordinate>> getAllPoints();
Future<ClusterCoordinate> getClusterPoints();
void showErrorMessage(IErrorModel response) {
if (this.scaffoldKey != null) {
@VB10
VB10 / regex_constats.dart
Last active March 3, 2021 07:41
String Regex
class RegexConstants {
static RegexConstants _instance;
static RegexConstants get instance {
if (_instance == null) {
_instance = RegexConstants._init();
}
return _instance;
}
RegexConstants._init();
ListView _buildListview(AsyncSnapshot<List<GiyimModel>> snapshot) {
return ListView.builder(
itemCount: snapshot.data.length,
itemBuilder: (BuildContext context, int index) {
GiyimModel item = snapshot.data[index];
return Container(
margin: EdgeInsets.symmetric(horizontal: 10, vertical: 15),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(6),