50 lines
1.2 KiB
Dart
50 lines
1.2 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
class PhoneMockup extends StatelessWidget {
|
|
final Widget child;
|
|
|
|
const PhoneMockup({super.key, required this.child});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
Size size = MediaQuery.of(context).size;
|
|
|
|
return Container(
|
|
width: size.width * 0.4,
|
|
height: size.height * 0.6,
|
|
decoration: BoxDecoration(
|
|
color: Colors.black,
|
|
borderRadius: BorderRadius.circular(40),
|
|
border: Border.all(color: Colors.black, width: 8),
|
|
),
|
|
child: Stack(
|
|
children: [
|
|
// Écran
|
|
Positioned.fill(
|
|
child: ClipRRect(
|
|
borderRadius: BorderRadius.circular(32),
|
|
child: Container(
|
|
color: Colors.white,
|
|
child: child,
|
|
),
|
|
),
|
|
),
|
|
// Notch
|
|
Positioned(
|
|
top: 8,
|
|
left:(size.width * 0.35) / 2,
|
|
right: (size.width * 0.35) / 2,
|
|
child: Container(
|
|
height: 20,
|
|
decoration: BoxDecoration(
|
|
color: Colors.black,
|
|
borderRadius: BorderRadius.circular(10),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|