Skip to content

Instantly share code, notes, and snippets.

View IhwanID's full-sized avatar

Ihwan IhwanID

View GitHub Profile
@IhwanID
IhwanID / ViewController.swift
Created September 24, 2020 06:25
Dekontaminasi Swift ViewController code
//
// ViewController.swift
// dekontaminasi
//
// Created by Ihwan ID on 24/09/20.
//
import UIKit
class ViewController: UIViewController {
@IhwanID
IhwanID / Stats.swift
Created September 24, 2020 05:59
Stats Dekontaminasi COVID19
struct StatsResponse: Codable {
let regions: [Province]
let numbers: Numbers
let timestamp: Int
let name: String
let type: String
}
struct Province: Codable {
let type: String
@IhwanID
IhwanID / response.json
Created September 24, 2020 05:09
current response json of https://dekontaminasi.com/api/id/covid19/stats timestamp: 1600819200000
{
"type": "country",
"name": "Indonesia",
"timestamp": 1600819200000,
"numbers": {
"infected": 257388,
"recovered": 187958,
"fatal": 9977
},
"regions": [
@IhwanID
IhwanID / ViewController.swift
Created September 6, 2020 08:04
Simpe Table View
//
// ViewController.swift
// simple-table-view
//
// Created by Ihwan ID on 06/09/20.
// Copyright © 2020 Ihwan ID. All rights reserved.
//
import UIKit
extension ViewController: UITableViewDataSource, UITableViewDelegate{
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 15
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = UITableViewCell()
cell.textLabel?.text = "Cell at \(indexPath.row+1)"
return cell
}
@IhwanID
IhwanID / custom_text_field.dart
Last active June 10, 2020 08:42
Custom Text Field with callback function
import 'package:flutter/material.dart';
class CustomTextField extends StatelessWidget {
final TextEditingController controller;
final String labelText;
final bool isObscureText;
final Function(String) onChanged;
CustomTextField(
{this.controller,
this.labelText,
@IhwanID
IhwanID / 1. main.dart
Last active June 10, 2020 08:42
Login Register Page in Flutter with separation widget
import 'package:flutter/material.dart';
import 'package:fluttercallback/common/action_button.dart';
import 'package:fluttercallback/common/custom_text_field.dart';
import 'package:fluttercallback/common/switch_button.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@IhwanID
IhwanID / main.dart
Created June 10, 2020 02:55
Simple Login Register Page in Flutter
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
@IhwanID
IhwanID / loading.dart
Created April 26, 2020 14:45
Loading widget with message in flutter
import 'package:flutter/material.dart';
class Loading extends StatelessWidget {
final String msg;
Loading({this.msg});
@override
Widget build(BuildContext context) {
return Center(
@IhwanID
IhwanID / company_modal.dart
Created April 26, 2020 14:38
Flutter Modal with rounded
import 'package:flutter/material.dart';
import 'package:pinjollist/model/company.dart';
import 'package:url_launcher/url_launcher.dart';
class CompanyModal extends StatelessWidget {
final Company company;
CompanyModal({this.company});
@override
Widget build(BuildContext context) {
return Container(