"Fossies" - the Fresh Open Source Software Archive

Member "flutter-3.7.0/examples/api/lib/widgets/basic/absorb_pointer.0.dart" (24 Jan 2023, 1466 Bytes) of package /linux/misc/flutter-3.7.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Dart source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "absorb_pointer.0.dart": 3.3.10_vs_3.7.0.

    1 // Copyright 2014 The Flutter Authors. All rights reserved.
    2 // Use of this source code is governed by a BSD-style license that can be
    3 // found in the LICENSE file.
    4 
    5 /// Flutter code sample for [AbsorbPointer].
    6 
    7 import 'package:flutter/material.dart';
    8 
    9 void main() => runApp(const MyApp());
   10 
   11 class MyApp extends StatelessWidget {
   12   const MyApp({super.key});
   13 
   14   static const String _title = 'Flutter Code Sample';
   15 
   16   @override
   17   Widget build(BuildContext context) {
   18     return MaterialApp(
   19       title: _title,
   20       home: Scaffold(
   21         appBar: AppBar(title: const Text(_title)),
   22         body: const Center(
   23           child: MyStatelessWidget(),
   24         ),
   25       ),
   26     );
   27   }
   28 }
   29 
   30 class MyStatelessWidget extends StatelessWidget {
   31   const MyStatelessWidget({super.key});
   32 
   33   @override
   34   Widget build(BuildContext context) {
   35     return Stack(
   36       alignment: AlignmentDirectional.center,
   37       children: <Widget>[
   38         SizedBox(
   39           width: 200.0,
   40           height: 100.0,
   41           child: ElevatedButton(
   42             onPressed: () {},
   43             child: null,
   44           ),
   45         ),
   46         SizedBox(
   47           width: 100.0,
   48           height: 200.0,
   49           child: AbsorbPointer(
   50             child: ElevatedButton(
   51               style: ElevatedButton.styleFrom(
   52                 backgroundColor: Colors.blue.shade200,
   53               ),
   54               onPressed: () {},
   55               child: null,
   56             ),
   57           ),
   58         ),
   59       ],
   60     );
   61   }
   62 }