physical_shape.0.dart 1.3 KB
Newer Older
1 2 3 4 5 6
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'package:flutter/material.dart';

7 8
/// Flutter code sample for [PhysicalShape].

9
void main() => runApp(const PhysicalShapeApp());
10

11 12
class PhysicalShapeApp extends StatelessWidget {
  const PhysicalShapeApp({super.key});
13 14 15

  @override
  Widget build(BuildContext context) {
16 17 18 19 20 21 22
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('PhysicalShape Sample'),
        ),
        body: const Center(child: PhysicalShapeExample()),
      ),
23 24 25 26
    );
  }
}

27 28
class PhysicalShapeExample extends StatelessWidget {
  const PhysicalShapeExample({super.key});
29 30 31

  @override
  Widget build(BuildContext context) {
32 33 34 35 36 37
    return PhysicalShape(
      elevation: 5.0,
      clipper: ShapeBorderClipper(
        shape: RoundedRectangleBorder(
          borderRadius: BorderRadius.circular(10.0),
        ),
38
      ),
39 40 41 42 43 44 45 46 47 48
      color: Colors.orange,
      child: const SizedBox(
        height: 200.0,
        width: 200.0,
        child: Center(
          child: Text(
            'Hello, World!',
            style: TextStyle(
              color: Colors.white,
              fontSize: 20.0,
49 50 51 52 53 54 55
            ),
          ),
        ),
      ),
    );
  }
}