Skip to content

Instantly share code, notes, and snippets.

@sbis04
Created June 24, 2019 12:40
Show Gist options
  • Save sbis04/f557c0d2779646b7ba2fc375cbc7e573 to your computer and use it in GitHub Desktop.
Save sbis04/f557c0d2779646b7ba2fc375cbc7e573 to your computer and use it in GitHub Desktop.
flutter_os_start_done
import 'package:flutter/material.dart';
import 'package:flutter_os/screens/name_screen.dart';
import 'package:flutter_os/utils.dart';
import 'package:wear/wear.dart';
class StartScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
body: 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;
var screenWidth = screenSize.width;
return Center(
child: Container(
color: Colors.white,
height: screenSize.height,
width: screenSize.width,
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
mainAxisSize: MainAxisSize.max,
children: <Widget>[
FlutterLogo(size: 90),
SizedBox(height: 20),
RaisedButton(
highlightColor: Colors.blue[900],
elevation: 6.0,
child: Text(
'START',
style: TextStyle(color: Colors.white, fontSize: 20),
),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
),
color: Colors.blue[400],
onPressed: () {
Navigator.of(context).push(MaterialPageRoute(builder: (context) {
return NameScreen(screenHeight, screenWidth);
}));
},
)
],
),
),
);
},
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment