expandable_page_view 1.0.1 copy "expandable_page_view: ^1.0.1" to clipboard
expandable_page_view: ^1.0.1 copied to clipboard

outdated

A PageView widget adjusting it's height to currently displayed page

example/lib/main.dart

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

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
        visualDensity: VisualDensity.adaptivePlatformDensity,
      ),
      home: MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);

  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: Text(widget.title),
        ),
        body: SingleChildScrollView(
          child: Column(
            children: [
              ExpandablePageView(
                children: [
                  ExamplePage(Colors.blue, "1", 100),
                  ExamplePage(Colors.green, "2", 200),
                  ExamplePage(Colors.red, "3", 300),
                ],
              ),
              ExpandablePageView(
                itemCount: 3,
                itemBuilder: (context, index) {
                  return ExamplePage(Colors.blue, index.toString(), index * 100.0);
                },
              ),
              const SizedBox(height: 20),
              Text("UNDER PAGE VIEW WIDGET"),
            ],
          ),
        ));
  }
}

class ExamplePage extends StatelessWidget {
  final Color color;
  final String text;
  final double height;

  const ExamplePage(this.color, this.text, this.height);

  @override
  Widget build(BuildContext context) {
    return Container(
      height: height,
      color: color,
      child: Center(
        child: Text(text),
      ),
    );
  }
}
470
likes
0
pub points
99%
popularity

Publisher

unverified uploader

A PageView widget adjusting it's height to currently displayed page

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on expandable_page_view