list_twolevel 0.0.5 copy "list_twolevel: ^0.0.5" to clipboard
list_twolevel: ^0.0.5 copied to clipboard

Two type listbuilder easy to use, fill with Map<> Obj.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:list_twolevel/list_A.dart';
import 'package:list_twolevel/list_B.dart';
void main() {
  runApp(const MyApp());
}

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

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      title: 'Two Level List',
      home: MyHomePage(),
    );
  }
}

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

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

class _MyHomePageState extends State<MyHomePage> {

  bool click = true;

  List<Map<String, String>> listALevelObj = [
    {'title': 'Vue', 'image': 'assets/Vue.png'},
    {'title': 'Web', 'image': 'assets/Web.png'},
    {'title': 'Flutter', 'image': 'assets/Flutter.png'},
    {'title': 'UnrealEngine', 'image': 'assets/UnrealEngine.png'}
  ];
  listA (){
    return AListBuilder(
      levelObj: listALevelObj,
      backgroundColor: const Color(0xFF2E2E48),
      onPressed: (selectedCategory) {
        debugPrint('click $selectedCategory ');
        setState(() {
          click = !click;
        });
      },
    );
  }

  List<Map<String, String>> listBLevelObj = [
    {'title':'title1'},
    {'title':'title2'},
    {'title':'title3'},
    {'title':'title4'},
    {'title':'title5'},
  ];
  listB (){
    return BListBuilder(
      levelObj: listBLevelObj,
      itemHeight: 50,
      backgroundColor: const Color(0xFF2E2E48),
      onPressed: (selectedTitle) {
        debugPrint('click $selectedTitle ');
        setState(() {
          click = !click;
        });
      },
    );
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: const Color(0xFF464667),
        body: click
            ? listA()
            : listB()
    );
  }
}
1
likes
100
pub points
0%
popularity

Publisher

unverified uploader

Two type listbuilder easy to use, fill with Map<> Obj.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (LICENSE)

Dependencies

flutter

More

Packages that depend on list_twolevel