Skip to content

Instantly share code, notes, and snippets.

View arulwastaken's full-sized avatar
🎯
Focusing

Arul arulwastaken

🎯
Focusing
  • Tamilnadu
View GitHub Profile
@arulwastaken
arulwastaken / MainActivity.kt
Created January 23, 2021 12:05
WVL implementation
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
WebView.setWebContentsDebuggingEnabled(true)
webview.settings.apply {
javaScriptEnabled = true
}
// wvl implementation
webview.webChromeClient = object : WebViewLogger(application = application) {
class MainActivity : AppCompatActivity() {
val camIntentCode = 100
val imageFile: File by lazy {
File(getExternalFilesDir(null)?.absolutePath + "/${System.currentTimeMillis()}.jpg")
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
@arulwastaken
arulwastaken / location_state.dart
Last active April 1, 2021 06:13
LocationState
class LocationState {
LocationEnum state;
String? message;
LocationData? location;
LocationState({required this.state, this.message, this.location});
static LocationState loading({String? message}) {
return LocationState(state: LocationEnum.LOADING, message: message);
@arulwastaken
arulwastaken / location_manger.dart
Created April 2, 2021 10:23
Location manger flutter
class LocationManager {
Location location = new Location();
bool _serviceEnabled = false;
PermissionStatus? _permissionGranted;
late LocationData _locationData;
Function(LocationState) callback;
LocationManager({required this.callback});
@arulwastaken
arulwastaken / homescreen.dart
Created April 2, 2021 10:27
Consume of location manager flutter
LocationManager(callback: (state) {
print("State ${state.toString()}");
switch(state.state) {
case LocationEnum.ERROR:
print("error ${state.message}");
break;
case LocationEnum.LOADING:
// TODO: Handle this case.
break;
case LocationEnum.REQUESTING_LOCATION_SERVICE:
class MvvmView extends StatefulWidget {
@override
_MvvmViewState createState() => _MvvmViewState();
}
class _MvvmViewState extends State<MvvmView> {
@override
class MvvmViewModel with ChangeNotifier {
String welcomeText = "";
final MvvmRepo repo;
MvvmViewModel(this.repo) {
loadWelcomeText();
}
class MvvmRepo {
Future<String> getWelcomeText() {
//
// from storage or Network
//
return Future.value("Puppy");
}
//... other methods
import 'package:myapp/src/values/colors.dart';
import 'package:flutter/material.dart';
class RatingBar extends StatefulWidget {
final double rating;
final bool makeRating;
final double? size;
final Function(double rating)? makeRatingCallback;