This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class LocationManager { | |
Location location = new Location(); | |
bool _serviceEnabled = false; | |
PermissionStatus? _permissionGranted; | |
late LocationData _locationData; | |
Function(LocationState) callback; | |
LocationManager({required this.callback}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MvvmView extends StatefulWidget { | |
@override | |
_MvvmViewState createState() => _MvvmViewState(); | |
} | |
class _MvvmViewState extends State<MvvmView> { | |
@override |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MvvmViewModel with ChangeNotifier { | |
String welcomeText = ""; | |
final MvvmRepo repo; | |
MvvmViewModel(this.repo) { | |
loadWelcomeText(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MvvmRepo { | |
Future<String> getWelcomeText() { | |
// | |
// from storage or Network | |
// | |
return Future.value("Puppy"); | |
} | |
//... other methods |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |