iphone_has_notch 0.0.2 iphone_has_notch: ^0.0.2 copied to clipboard
Returns true if the phone is iPhone and it has notch, returns false otherwise.
import 'package:flutter/material.dart';
import 'package:iphone_has_notch/iphone_has_notch.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
final String title;
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Container(
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
'This phone is iPhone and it has notch',
style: TextStyle(fontSize: 16, color: Colors.black),
),
Text(
'${IphoneHasNotch.hasNotch}',
style: TextStyle(fontSize: 30, color: Colors.blue[800]),
),
],
),
),
);
}
}