Skip to content

Instantly share code, notes, and snippets.

@IkhwanSI13
IkhwanSI13 / NestedScrollViewLoadMore
Last active November 8, 2022 12:39
load more data in NestedScrollView with NotificationListener
import 'package:cartenz_djp/style/colors.dart';
import 'package:cartenz_djp/widget/override/customTabs.dart' as Tabs;
import 'package:flutter/material.dart';
class ExampleWidget extends StatefulWidget {
@override
State<StatefulWidget> createState() => ExampleState();
}
class ExampleState extends State<ExampleWidget> {
@IkhwanSI13
IkhwanSI13 / Example
Created March 13, 2020 14:34
Contoh pass function to another widget
import 'package:flutter/material.dart';
import 'package:ikanas/style/Colors.dart';
class ExampleActivity extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: ColorWhite,
resizeToAvoidBottomPadding: true,
body: BaseButton(onClickLogin),
@IkhwanSI13
IkhwanSI13 / CameraManifest
Created March 14, 2020 09:50
Permission for camera
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.ikhwankoto.cameraandcamerax">
<uses-permission android:name="android.permission.CAMERA" />
<application .. >
<activity .. />
</application>
@IkhwanSI13
IkhwanSI13 / RecyclerView
Created April 23, 2020 12:28
Live template for RecyclerView
#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME};#end
import android.content.Context
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import kotlinx.android.extensions.LayoutContainer
import androidx.recyclerview.widget.RecyclerView
import kotlinx.android.synthetic.main.${LAYOUT_NAME}.*
@IkhwanSI13
IkhwanSI13 / template.xml
Created May 10, 2020 08:11
template.xml for MVP Activity
<?xml version="1.0"?>
<template
format="5"
revision="1"
name="MVP Activity"
description="Creates a new activity with MVP Pattern">
<category value="Activity" />
<formfactor value="Mobile" />
@IkhwanSI13
IkhwanSI13 / globals.xml.ftl
Created May 10, 2020 09:11
file for activity template for MVP pattern
<?xml version="1.0"?>
<globals>
<global id="hasNoActionBar" type="boolean" value="false" />
<global id="simpleLayoutName" value="${layoutName}" />
<global id="activityClass" value="${mvpClass}Activity" />
<global id="excludeMenu" type="boolean" value="true" />
<global id="generateActivityTitle" type="boolean" value="false" />
<#include "../common/common_globals.xml.ftl" />
</globals>
@IkhwanSI13
IkhwanSI13 / recipe.xml.ftl
Created May 10, 2020 09:19
recipe.xml.ftl for activity with MVP patter
<?xml version="1.0"?>
<#import "root://activities/common/kotlin_macros.ftl" as kt>
<recipe>
<#include "../common/recipe_manifest.xml.ftl" />
<@kt.addAllKotlinDependencies />
<#include "../common/recipe_simple.xml.ftl" />
<open file="${escapeXmlAttribute(resOut)}/layout/${layoutName}.xml" />
<instantiate from="root/src/app_package/ViewClass.kt.ftl"
@IkhwanSI13
IkhwanSI13 / ViewClass.kt.ftl
Created May 10, 2020 09:46
Activity template with MVP pattern
package ${escapeKotlinIdentifiers(packageName)}
import android.content.Context
import android.content.Intent
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
class ${mvpClass}Activity : AppCompatActivity(), ${mvpClass}Contract.View {
lateinit var presenter: ${mvpClass}Presenter
package ${escapeKotlinIdentifiers(packageName)}
interface ${mvpClass}Contract {
interface View{
}
interface Presenter {
fun dropView()
}
}
package ${escapeKotlinIdentifiers(packageName)}
import android.content.Context
class ${mvpClass}Presenter(var view: ${mvpClass}Contract.View)
: ${mvpClass}Contract.Presenter {
override fun dropView() {
}