Skip to content

Instantly share code, notes, and snippets.

View ymkp's full-sized avatar

Yochanan Maranatha ymkp

  • Semarang, Indonesia
View GitHub Profile
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:eppid/const/theme.dart';
class CustomFormTextField extends StatefulWidget {
const CustomFormTextField({
required this.name,
required this.validator,
this.hintText = '',
this.onSaved,
String getGoogleMapsUrlFromLatLongString(String latLong) {
return 'https://www.google.com/maps/search/?api=1&query=$latLong';
}
const _bulans = ['', 'Januari', 'Februari', 'Maret', 'April', 'Mei', 'Juni', 'Juli', 'Agustus', 'September', 'Oktober', 'November', 'Desember'];
String getQueryStringFromMap(Map<String, dynamic> map) {
String a = '';
int i = 0;
map.forEach((key, value) {
// import 'dart:developer';
import 'dart:developer';
import 'package:app/shared/models/file_model.dart';
import 'package:flutter/foundation.dart';
import 'package:http/http.dart' as http;
import 'dart:convert';
import 'package:app/shared/utils/string_helper.dart';
NotificationListener<ScrollNotification>(
onNotification: (ScrollNotification scrollInfo) {
if (scrollInfo is ScrollEndNotification && // ? <-- dia dah di paling bawah, padding child juga dihitung
scrollInfo.metrics.extentAfter == 0 && // ? <-- bener2 mentok sampai ada splash-nya
_shopController.productState == ProductState.ok && //? <-- kondisi tambahan, cuma reload kalau lagi tidak loading
_shopController.pageQ != -1) { //? <-- kondisi tambahan, cuma reload kalau bukan halaman/paginasi terakhir
_shopController.getAllProductsNextPage(); //? <-- yang dilakukan untuk get next items
return true;
}
return false;
final DateFormat format = DateFormat('EEEE,').add_jm();
final DateFormat format2 = DateFormat('yyyy-MM-dd,').add_jm();
int calculateDifference(DateTime date) {
DateTime now = DateTime.now();
return DateTime(date.year, date.month, date.day).difference(DateTime(now.year, now.month, now.day)).inDays;
}
String getDate(DateTime calcDate) {
var stringDate = format.format(calcDate);
import 'package:flutter/material.dart';
class HightlightText extends StatelessWidget {
final String text; // ? text semuanya
final String highlight; // ? text yg mau di-hightlight
final TextStyle style; // ? textstyle umum untuk semuanya
final TextStyle highlightStyle; // ? textstyle untuk si yg mau di-highlight
final bool ignoreCase; // ? true nanti ignore kapital huruf kecil
const HightlightText({
Widget buildSearchMyConsultation(BuildContext context) {
return TypeAheadField(
hideOnLoading: true,
textFieldConfiguration: TextFieldConfiguration(
style: kPoppinsRegular400.copyWith(color: hinTextColor, fontSize: 10),
decoration: InputDecoration(
prefix: const SizedBox(
width: 10,
),
enabledBorder: OutlineInputBorder(