avatar

松果工作室

欢迎光临

  • 首页
  • ESP
  • LVGL
  • freeRTOS
  • 快速笔记
  • 考察日志
  • 个人收藏
  • 我的服务
Home (Flutter)消息滑块
文章

(Flutter)消息滑块

Posted 2025-04-12 Updated 2025-04- 12
By YCP
4~5 min read

CODE

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

void main() {
  return runApp(MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: MyHomePage(),
      debugShowCheckedModeBanner: false,
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({Key? key}) : super(key: key);

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(),
      body: ListView(
      children: [
        Slidable(
          startActionPane: ActionPane(
            motion: ScrollMotion(),
            children: [
              SlidableAction(
                onPressed: (context) {
                  // call number
                },
                icon: Icons.phone,
              ),
            ],
          ),
          endActionPane: ActionPane(
            motion: ScrollMotion(),
            children: [
              SlidableAction(
                onPressed: (context) {
                  // call number
                },
                icon: Icons.delete,
              ),
            ],
          ),
          child: Container(
            color: Colors.grey,
            child: ListTile(
              title: Text('Hello World'),
              //trailing: Icon(Icons.delete),
              subtitle: Text('Hello World'),
              leading: Icon(Icons.star),
            ),
          ),
        ),
      ],
      ),
    );
  }
}

预览

截屏2025-04-12 下午12.39.09.png

Flutter
License:  CC BY 4.0
Share

Further Reading

OLDER

(Flutter)进度列表

NEWER

(Flutter)滑条控件

Recently Updated

  • (ESP-IDF)LVGL 模拟器
  • (ESP-IDF)LVGL 自定义对象加入编码器组
  • (ESP-IDF)vscode配置文件
  • (Elec)来复再生式晶体管单管收音机
  • (ESP-IDF)ESPNOW

Trending Tags

LVGL WCH Linux Elec ThatProject freeRTOS STM ESP Flutter Others

Contents

©2026 松果工作室. Some rights reserved.

Using the Halo theme Chirpy