Kuunda Popover kwa kutumia Kishale ndani Flutter

Ili kuunda Flutter dirisha ibukizi kwa mshale unaoelekeza kwenye kipengele mahususi, unaweza kutumia Popover wijeti kutoka kwa popover kifurushi. Hivi ndivyo unavyoweza kuifanya:

Ongeza popover kifurushi kwenye faili yako pubspec.yaml:

dependencies:
  flutter:  
    sdk: flutter  
  popover: ^0.5.0  

Ingiza vifurushi vinavyohitajika:

import 'package:flutter/material.dart';  
import 'package:popover/popover.dart';  

Tumia Popover wijeti:

void main() {  
  runApp(MyApp());  
}  
  
class MyApp extends StatelessWidget {  
  @override  
  Widget build(BuildContext context) {  
    return MaterialApp(  
      home: MyHomePage(),  
   );  
  }  
}  
  
class MyHomePage extends StatelessWidget {  
  @override  
  Widget build(BuildContext context) {  
    return Scaffold(  
      appBar: AppBar(  
        title: Text('Popover Example'),  
     ),  
      body: Center(  
        child: Popover(  
          child: ElevatedButton(  
            onPressed:() {},  
            child: Text('Open Popup'),  
         ),  
          bodyBuilder:(BuildContext context) {  
            return Container(  
              padding: EdgeInsets.all(10),  
              child: Column(  
                mainAxisSize: MainAxisSize.min,  
                children: [  
                  Text('This is a popover with an arrow.'),  
                  SizedBox(height: 10),  
                  Icon(Icons.arrow_drop_up, color: Colors.grey),  
                ],  
             ),  
           );  
          },  
       ),  
     ),  
   );  
  }  
}  

Katika mfano huu, Popover wijeti inatumiwa kuunda popover na mshale unaoelekeza kutoka kwa kitufe hadi yaliyomo. Sifa child ni kipengele kinachochochea popover, na bodyBuilder sifa ni simu inayorudisha maudhui ya popover.

Kumbuka kubinafsisha yaliyomo, mwonekano na tabia ya watu wengi kulingana na mahitaji yako. Mfano huu unaonyesha matumizi ya popover kifurushi cha kuunda popover kwa mishale katika Flutter.