iphone_has_notch 1.0.0
iphone_has_notch: ^1.0.0 copied to clipboard

Returns true if the phone is iPhone and it has notch, returns false otherwise.

example/lib/main.dart

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]),
            ),
          ],
        ),
      ),
    );
  }
}
6
likes
120
pub points
76%
popularity

Publisher

awaik.pro

Returns true if the phone is iPhone and it has notch, returns false otherwise.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on iphone_has_notch