Coder Social home page Coder Social logo

bookfx's Introduction

模拟纸质书籍翻页效果

本项目主要模拟了我们在看书籍时的翻页动作,并支持了电子书直接预览。
如果你阅读文本电子书,可以直接使用EBook组件,如果你用来阅读其他例如插画等不需要计算字数的内容,请使用BookFx组件。

目前支持的功能

1、支持直接读取txt文件文本阅读,调整字号,模拟翻页。

2、支持自定义当前页、下一页、指定页面的Widget布局内容。

3、支持手势横向滑动翻页,优化了手势控制区域,支持返回上一页。

4、支持翻页动画自定义设置。

5、支持跳到指定页。

使用:

导入:

 import 'package:bookfx/bookfx.dart';

如果你想用在书籍需要计算文字的场景,可以使用EBook,如果你想用在其他场景,例如插画,可以使用BookFx,自定义布局。

效果

电子书:

image

插画:

image

示例代码:

电子书:

EBook(
    maxWith: MediaQuery.of(context).size.width,
    eBookController: eBookController,
    bookController: bookController,
    data: data,
    fontSize: eBookController.fontSize,
    padding: const EdgeInsetsDirectional.all(15),
    maxHeight:600),

插画:

 BookFx(
     size: Size(MediaQuery.of(context).size.width, 600),
     pageCount: images.length,
     currentPage: (index) {
       return Image.asset(
         images[index],
         fit: BoxFit.fill,
         width: MediaQuery.of(context).size.width,
       );
     },
     lastCallBack: (index) {
       if (index == 0) {
         return;
       }
       setState(() {});
     },
     nextPage: (index) {
       return Image.asset(
         images[index],
         fit: BoxFit.fill,
         width: MediaQuery.of(context).size.width,
       );
     },
     controller: bookController),

bookfx's People

Contributors

lixp185 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.