This file contains hidden or 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 android.content.Context; | |
import android.support.v4.app.Fragment; | |
import android.support.v4.app.FragmentManager; | |
import android.support.v4.app.FragmentPagerAdapter; | |
public class CategoryAdapter extends FragmentPagerAdapter { | |
private Context mContext; | |
This file contains hidden or 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
package com.example.android.quakereport; | |
import android.util.Log; | |
import org.json.JSONArray; | |
import org.json.JSONException; | |
import org.json.JSONObject; | |
import java.util.ArrayList; |
This file contains hidden or 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
$ flutter create my_app |
This file contains hidden or 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
dependencies: | |
audioplayers: ^0.7.8 | |
wear: ^0.0.3 |
This file contains hidden or 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
<!-- Required for ambient mode support --> | |
<uses-permission android:name="android.permission.WAKE_LOCK" /> | |
<!-- Flags the app as a Wear app --> | |
<uses-feature android:name="android.hardware.type.watch" /> | |
<!-- Flags that the app doesn't require a companion phone app --> | |
<application> | |
<meta-data | |
android:name="com.google.android.wearable.standalone" |
This file contains hidden or 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: FlutterActivity(), AmbientMode.AmbientCallbackProvider { | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
GeneratedPluginRegistrant.registerWith(this) | |
// Wire up the activity for ambient callbacks | |
AmbientMode.attachAmbientSupport(this) | |
} | |
override fun getAmbientCallback(): AmbientMode.AmbientCallback { |
This file contains hidden or 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:flutter/material.dart'; | |
import 'package:wear/wear.dart'; |
This file contains hidden or 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:flutter/material.dart'; | |
import 'package:flutter_os/screens/ambient_screen.dart'; | |
import 'package:flutter_os/screens/start_screen.dart'; | |
import 'package:wear/wear.dart'; | |
void main() => runApp(MyApp()); | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) => MaterialApp( |
This file contains hidden or 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:flutter/material.dart'; | |
class AmbientWatchFace extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) => Scaffold( | |
backgroundColor: Colors.black, | |
body: Center( | |
child: Column( | |
mainAxisAlignment: MainAxisAlignment.center, | |
crossAxisAlignment: CrossAxisAlignment.center, |
This file contains hidden or 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
WatchShape( | |
builder: (context, shape) { | |
var screenSize = MediaQuery.of(context).size; | |
final shape = InheritedShape.of(context).shape; | |
if (shape == Shape.round) { | |
// boxInsetLength requires radius, so divide by 2 | |
screenSize = Size(boxInsetLength(screenSize.width / 2), | |
boxInsetLength(screenSize.height / 2)); | |
} | |
var screenHeight = screenSize.height; |