Skip to content

Instantly share code, notes, and snippets.

View encikpulasan's full-sized avatar
🕌
🏃🏻💨

encikpulasan

🕌
🏃🏻💨
  • Johor, Malaysia
View GitHub Profile
@encikpulasan
encikpulasan / gauge.dart
Created September 2, 2021 05:28
Gauge chart implementing ChartFultter package
/// Gauge chart example, where the data does not cover a full revolution in the
/// chart.
/// Sample data type.
class GaugeSegment {
final String segment;
final double size;
final Color color;
final Icon icon;
@encikpulasan
encikpulasan / RecentTransaction Recursive
Created August 17, 2021 07:40
Exploring recursive implementation from for loop
/// Loop through RecentTransaction to perform specific function
void searchTransaction(Transaction transaction, void Function(int i, int j) function) {
for (var i = 0; i < recentTransactions!.dailyTransactions!.length; i++) {
DailyTransaction dailyTransaction = recentTransactions!.dailyTransactions![i];
for (var j = 0; j < dailyTransaction.transactions!.length; j++) {
Transaction trx = dailyTransaction.transactions![j];
if (trx.id == transaction.id) {
function(i, j);
}
}
@encikpulasan
encikpulasan / device_info_utils.dart
Created June 25, 2021 05:57
Flutter Device Info Utility Helper
import 'dart:io';
import 'package:device_info_plus/device_info_plus.dart';
class DeviceInfoUtils {
final DeviceInfoPlugin deviceInfo = DeviceInfoPlugin();
/// Info available for both iOS & Android OS
String? deviceId;
String? deviceName;
@encikpulasan
encikpulasan / expanded_card.dart
Created January 18, 2021 20:20
expanded card
AnimatedPadding(
duration: Duration(milliseconds: 300),
padding: EdgeInsets.only(top: 80),
child: GestureDetector(
onTap: this.onTap,
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 16.0),
child: Container(
width: double.infinity,
height: double.infinity,
extension CapExtension on String {
//first letter only
String get inCaps => '${this[0].toUpperCase()}${this.substring(1)}';
//all letter in string
String get allInCaps => this.toUpperCase();
//first letter for each word in a string
String get titleCase => this
.split(' ')
.map((word) => word[0].toUpperCase() + word.substring(1))
.join(' ');
@encikpulasan
encikpulasan / index.html
Created October 10, 2016 11:13
Siapa Hensem?
Akif Hensem