NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:gurulduyo/utils/screen.dart';

class Helpers {
static bool isNullOrEmpty(String value) {
return value != null && value.length > 0;
}

static String durationToString(int minutes) {
var d = Duration(minutes: minutes);
List<String> parts = d.toString().split(':');
if (minutes >= 600)
return '${parts[0].padLeft(2, '0')}:${parts[1].padLeft(2, '0')} saate';
else if (minutes >= 60)
return '${parts[0].padLeft(1, '1')}:${parts[1].padLeft(2, '0')} saate';
else
return '${parts[1].padLeft(2, '0')} dakikaya';
}

static Widget getOpenOrClose(
bool isAvaible, String openingTime, String closingTime) {
var status = "Açık";
if (!isAvaible) {
status = "Kapalı";
} else {
try {
var opening = DateTime.parse(openingTime).millisecondsSinceEpoch;
var closing = DateTime.parse(closingTime).millisecondsSinceEpoch;
var dateTime = DateTime.now().millisecondsSinceEpoch;

if (dateTime >= opening && dateTime <= closing) {
status = "Açık";
}
} catch (e) {
status = "Kapalı";
}
}

return Text(
status,
style: TextStyle(
color: Colors.green,
fontSize: Screen.size(14),
fontWeight: FontWeight.w500,
),
);
}
}

--------------------------------------
import 'dart:convert';

class RestaurantModel {
RestaurantModel({
this.id,
this.userId,
this.name,
this.description,
this.address,
this.logoPath,
this.isAvaliable,
this.distance,
this.distanceString,
this.latitude,
this.longitude,
this.openingTime,
this.closingTime,
this.restaurantCategories,
});

int id;
int userId;
String name;
String description;
String address;
String logoPath;
bool isAvaliable;
double distance;
String distanceString;
double latitude;
double longitude;
String openingTime;
String closingTime;
List<RestaurantCategory> restaurantCategories;

factory RestaurantModel.fromJson(String str) =>
RestaurantModel.fromMap(json.decode(str));

String toJson() => json.encode(toMap());

factory RestaurantModel.fromMap(Map<String, dynamic> json) => RestaurantModel(
id: json["id"],
userId: json["userId"],
name: json["name"],
description: json["description"],
address: json["address"],
logoPath: json["logoPath"],
isAvaliable: json["isAvaliable"],
distance: json["distance"].toDouble(),
distanceString: json["distanceString"],
latitude: json["latitude"].toDouble(),
longitude: json["longitude"].toDouble(),
openingTime: json["openingTime"],
closingTime: json["closingTime"],
restaurantCategories: List<RestaurantCategory>.from(
json["restaurantCategories"]
.map((x) => RestaurantCategory.fromMap(x))),
);

Map<String, dynamic> toMap() => {
"id": id,
"userId": userId,
"name": name,
"description": description,
"address": address,
"logoPath": logoPath,
"isAvaliable": isAvaliable,
"distance": distance,
"distanceString": distanceString,
"latitude": latitude,
"longitude": longitude,
"openingTime": openingTime,
"closingTime": closingTime,
"restaurantCategories":
List<dynamic>.from(restaurantCategories.map((x) => x.toMap())),
};
}

class RestaurantCategory {
RestaurantCategory({
this.categoryId,
this.categoryName,
});

int categoryId;
String categoryName;

factory RestaurantCategory.fromJson(String str) =>
RestaurantCategory.fromMap(json.decode(str));

String toJson() => json.encode(toMap());

factory RestaurantCategory.fromMap(Map<String, dynamic> json) =>
RestaurantCategory(
categoryId: json["categoryId"],
categoryName: json["categoryName"],
);

Map<String, dynamic> toMap() => {
"categoryId": categoryId,
"categoryName": categoryName,
};
}

------------------------

Helpers.getOpenOrClose(
model.isAvaliable,
model.openingTime,
model.closingTime),
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.