horizontal_indicator 0.1.0 copy "horizontal_indicator: ^0.1.0" to clipboard
horizontal_indicator: ^0.1.0 copied to clipboard

Package to add day of month with day of week as horizontal list with active bubbles.

example/lib/main.dart

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

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      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> {
  int _counter = 1;

  void _incrementCounter() {
    setState(() {
      _counter++;
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
        bottom: PreferredSize(
          preferredSize: Size(double.infinity, 68),
          child: DateIndicator(
            holderColor: Colors.lightBlueAccent.withOpacity(.5),
            numberColor: Colors.blueAccent,
            textColor: Colors.blue,
            activeBubbleColor: Colors.redAccent,
            unSelectedBorderColor: Colors.grey,
            selectedBorderColor: Colors.blueAccent,
            indicatorColor: Colors.greenAccent.withOpacity(.4),
            indicatorShadowColor: Colors.greenAccent.withOpacity(.3),
//            hideDayOfWeek: true,
//            activeBubbleLeftPosition: 0,
//            activeBubbleRightPosition: 30,
//            activeBubbleBottomPosition: 32,
            activeHolders: [1, 4, 6, 7, 8, 10, 11, 14, 13, 31, 27],
            initialDay: _counter,
            onHolderTap: (int index) => onHolderTapped(index),
            updateSelectedDay: _counter,
          ),
        ),
      ),
      body: Center(
        child: PageView.builder(
          controller: PageController(initialPage: _counter),
          onPageChanged: (int index) => onHolderTapped(index),
          itemBuilder: (BuildContext context, int index) =>
              buildColumn(context),
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: _incrementCounter,
        tooltip: 'Increment',
        child: Icon(Icons.add),
      ),
    );
  }

  void onHolderTapped(int index) {
    debugPrint(index.toString());
    setState(() => _counter = index);
  }

  Column buildColumn(BuildContext context) {
    return Column(
      mainAxisAlignment: MainAxisAlignment.center,
      children: <Widget>[
        Text(
          'You have pushed the button this many times:',
        ),
        Text(
          '$_counter',
          style: Theme.of(context).textTheme.display1,
        ),
      ],
    );
  }
}
3
likes
40
pub points
11%
popularity

Publisher

unverified uploader

Package to add day of month with day of week as horizontal list with active bubbles.

Repository (GitHub)
View/report issues

License

MIT (LICENSE)

Dependencies

flutter, intl

More

Packages that depend on horizontal_indicator