Skip to content

Instantly share code, notes, and snippets.

@iam111
iam111 / date_picker.dart
Last active February 15, 2024 05:30
DatePicker
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
class MyHomePage extends StatefulWidget {
const MyHomePage({Key? key, required this.title}) : super(key: key);
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
plugins {
id 'com.android.library'
id 'maven-publish'
}
def artifactId = "artifactId"
def groupId = "com.example.groupId"
android {
namespace 'com.my.library'
compileSdk 31
@iam111
iam111 / build.gradle
Last active December 29, 2023 13:06
For gradle 8 or higher
android {
publishing {
singleVariant('release') {
withSourcesJar() // you can remove this
withJavadocJar() // you can remove this
}
}
}
@iam111
iam111 / build.gradle
Created December 29, 2023 12:59
Complete build.gradle file when using Sonatype selfhosted Nexus
plugins {
id 'com.android.library'
id 'maven-publish'
}
def artifactId = "artifactId"
def groupId = "com.example.groupId"
android {
namespace 'com.my.library'
compileSdk 31
@iam111
iam111 / build.gradle
Last active December 29, 2023 12:55
For gradle below 8
afterEvaluate {
publishing {
publications {
// Creates a Maven publication called "release".
release(MavenPublication) {
from components.release
setGroupId groupId
setArtifactId artifactId
version android.defaultConfig.versionName
}
@iam111
iam111 / build.gradle
Last active November 3, 2023 07:27
> Could not resolve all artifacts for configuration ':url_launcher_android:debugUnitTestRuntimeClasspath'. > Failed to transform bcprov-jdk18on-1.72.jar (org.bouncycastle:bcprov-jdk18on:1.72) to match attributes {artifactType=processed-jar, org.gradle.category=library, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=j…
android {
// ADD follwing block
lintOptions {
disable 'InvalidPackage'
disable "Instantiatable"
checkReleaseBuilds false
abortOnError false
}
@iam111
iam111 / add_markers.dart
Last active October 12, 2023 07:45
Custom Google Map Flutter
Set<Marker> markerLocations = <Marker>{
const Marker(
markerId: MarkerId('location1'),
position: LatLng(37.483210, -122.145176),
),
const Marker(
markerId: MarkerId('location2'),
position: LatLng(37.482144, -122.144668),
)
};
@iam111
iam111 / generateList.dart
Last active October 4, 2023 10:36
Generate sample list with flutter
import 'dart:math';
import 'package:flutter/material.dart';
class GenerateList extends StatefulWidget {
const GenerateList({super.key});
@override
State<GenerateList> createState() => _GenerateListState();
}