Skip to content

Instantly share code, notes, and snippets.

@rodydavis
rodydavis / videopreview.dart
Created May 15, 2018 17:25
Preview a video from view_player controller in Flutter.
import 'package:flutter/material.dart';
import 'package:video_player/video_player.dart';
class AspectRatioVideo extends StatefulWidget {
final VideoPlayerController controller;
AspectRatioVideo(this.controller);
@override
AspectRatioVideoState createState() => new AspectRatioVideoState();
import UIKit
import XCPlayground
let containerView = UIView(frame: CGRect(x: 0.0, y: 0.0, width: 375.0, height: 667.0))
XCPShowView(identifier: "Container View", view: containerView)
let circle = UIView(frame: CGRect(x: 0.0, y: 0.0, width: 50.0, height: 50.0))
circle.center = containerView.center
circle.layer.cornerRadius = 25.0
@rodydavis
rodydavis / ScriptFastlane.sh
Created May 18, 2018 12:24
Automator Fastlane Scripts
//Beta
on run {input, parameters}
tell application "Terminal"
activate
do script "cd <YOUR PROJECT PATH>/android && fastlane beta && cd <YOUR PROJECT PATH>/ios && fastlane beta"
end tell
tell application "System Events"
try
set visible of application process "Terminal" to false
end try
@rodydavis
rodydavis / native_widgets.dart
Created June 29, 2018 16:56
Flutter Native Widgets for iOS and Android that look correct for each platform.
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'dart:io';
// Native Button
class NativeButton extends StatelessWidget {
final Widget child;
final VoidCallback onPressed;
final Color buttonColor;
final EdgeInsetsGeometry padding;
@rodydavis
rodydavis / flutter_fastlane.dart
Last active June 29, 2018 20:02
Fastlane Fastfiles for iOS and Android
update_fastlane
default_platform(:ios)
platform :ios do
desc "Push a new beta build to TestFlight"
lane :beta do
increment_build_number(xcodeproj: "Runner.xcodeproj")
build_app(workspace: "Runner.xcworkspace", scheme: "Runner")
upload_to_testflight(skip_waiting_for_build_processing: true)
@rodydavis
rodydavis / nativepicker.dart
Last active June 30, 2018 01:27
In Flutter show a Drop Down for Android and a Picker for iOS
import 'dart:io';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:my_unify_mobile/custom/native_widgets.dart';
class ExamplePickerPage extends StatefulWidget {
@override
ExamplePickerPageState createState() => ExamplePickerPageState();
}
@rodydavis
rodydavis / startpage.dart
Created July 3, 2018 13:02
Example of using the whats new custom widget for flutter.
import 'package:flutter/material.dart';
import 'package:Unify_Mobile/globals.dart' as globals;
import 'package:Unify_Mobile/custom/whatsnew.dart';
class StartPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
List<WhatsNewItem> _items = [
WhatsNewItem(
title: Text('Dart Theme'),
@rodydavis
rodydavis / whatsnew.dart
Last active July 5, 2018 12:38
Drop in file for flutter to show a whats new page for the user that is native for android and iOS. (Similar to apples version in keynote, pages, app store and other apps)
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'dart:io';
import 'dart:async';
//Example
class StartPage extends StatelessWidget {
// Example to Put on Login Function to Only Show on Version Change
// var prefs = await SharedPreferences.getInstance();
// Copyright (c) 2017, Spencer. All rights reserved. Use of this source code
// is governed by a BSD-style license that can be found in the LICENSE file.
import 'package:flutter/material.dart';
import 'package:meta/meta.dart';
typedef AppBar AppBarCallback(BuildContext context);
typedef void TextFieldSubmitCallback(String value);
typedef void SetStateCallback(void fn());
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter/material.dart';
class SearchDemo extends StatefulWidget {
static const String routeName = '/material/search';
@override