Skip to content

Instantly share code, notes, and snippets.

@Eng-MFQ
Last active January 3, 2019 09:50
Show Gist options
  • Save Eng-MFQ/43e45e565f0d7bf0dc49b87e931e68ec to your computer and use it in GitHub Desktop.
Save Eng-MFQ/43e45e565f0d7bf0dc49b87e931e68ec to your computer and use it in GitHub Desktop.
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
/// this is your APP Main screen configuration
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(
// to change your app color change this
/// first color is for IOS the second color is for Android
/*******************--[focus here 🧐]--*******************/
primaryColor: defaultTargetPlatform == TargetPlatform.iOS
? Colors.amber
: Colors.teal,
),
home: Platform(),
);
}
}
class Platform extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
leading: Icon(
Icons.smartphone,
size: 24,
),
elevation: 6,
title: Text('App Title'),
),
body: Padding(
padding: const EdgeInsets.all(20.0),
child: defaultTargetPlatform == TargetPlatform.iOS
? ios(context)
: android(context))
);
}
}
Widget android(BuildContext context) {
return Text('replace with Android button and Switch');
}
Widget ios(BuildContext context) {
return Text('replace with iOS button and switch');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment