Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

redbluenat

🏠
Working from home
View GitHub Profile
View styles.xml
<resources>
<style name="SplashTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowFullscreen">true</item>
<item name="android:background">@drawable/splash_screen_light</item>
</style>
<style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
<!-- Customize your theme here. -->
<item name="android:textColor">#000000</item>
<item name="colorAccent">#1e9f21</item>
View MainActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
switch (getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) {
case Configuration.UI_MODE_NIGHT_YES:
setTheme(R.style.DarkTheme);
break;
case Configuration.UI_MODE_NIGHT_NO:
setTheme(R.style.LightTheme);
break;
View splash_screen._dark.xml
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/splash_background"
android:drawable="@android:color/darker_gray"
android:gravity="fill" >
</item>
View styles.xml
<resources>
<style name="SplashTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowFullscreen">true</item>
<item name="android:background">@drawable/splash_screen_dark</item>
</style>
<style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
<item name="android:textColor">#000000</item>
<item name="colorAccent">#1e9f21</item>
</style>
View styles.xml
<resources>
<style name="SplashTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowFullscreen">true</item>
<item name="android:background">@drawable/splash_screen_light</item>
</style>
<style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
<!-- Customize your theme here. -->
<item name="android:textColor">#000000</item>
<item name="colorAccent">#1e9f21</item>
View AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.basicsetup">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:name=".MainApplication"
android:allowBackup="false"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
View SplashScreenActivity.java
public class SplashScreenActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intent intent = new Intent(this, MainActivity.class);
startActivity(intent);
finish();
}
View camera.dart
import 'dart:async';
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:camera/camera.dart';
import 'package:path_provider/path_provider.dart';
List<CameraDescription> cameras;
IconData getCameraLensIcon(CameraLensDirection direction) {
switch (direction) {
View inputs.dart
Widget beerInfoInputsWidget() {
return Column(
children: [
Padding(
padding: const EdgeInsets.only(left: 3, bottom: 4.0),
child: TextField(
controller: nameController,
onChanged: (v) => nameController.text = v,
decoration: InputDecoration(
labelText: 'Name the beer',
View changecamera.dart
void onNewCameraSelected(CameraDescription cameraDescription) async {
if (controller != null) {
await controller.dispose();
}
controller = CameraController(cameraDescription, ResolutionPreset.high);
controller.addListener(() {
if (mounted) setState(() {});
if (controller.value.hasError) {
showInSnackBar('Camera error ${controller.value.errorDescription}');