segment_control 0.1.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 75

segment_control #

A segment control based on Tabbar implementation
一个基于TabBar控件改装的Segment控件

Demo #

Features #

  • [x] 自定义选项数据
  • [x] 自定义样式,包括选中和未选中的背景色,字体样式以及边框颜色,圆角等
  • [x] 回调返回选择的选项索引以及标题
  • [x] 可以设置未选中样式

Contact me #

[0.1.0] - TODO: Add release date.

  • TODO: Describe initial release.

example/README.md

example #

A new Flutter application.

Getting Started #

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  segment_control: ^0.1.0

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:segment_control/segment_control.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
58
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
78
Overall:
Weighted score of the above. [more]
75
Learn more about scoring.

We analyzed this package on Dec 11, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.6.1
  • pana: 0.13.1+4
  • Flutter: 1.12.13+hotfix.2

Health suggestions

Fix lib/segment_control.dart. (-0.50 points)

Analysis of lib/segment_control.dart reported 1 hint:

line 7 col 7: This class (or a class which this class inherits from) is marked as '@immutable', but one or more of its instance fields are not final: SegmentControl.state

Maintenance issues and suggestions

Make sure dartdoc successfully runs on your package's source files. (-10 points)

Running dartdoc failed with the following output: DetailedApiRequestError(status: 504, message: )

#0      _validateResponse (package:_discoveryapis_commons/src/clients.dart:852:9)
<asynchronous suspension>
#1      ApiRequester.request (package:_discoveryapis_commons/src/clients.dart:74:22)
<asynchronous suspension>
#2      ObjectsResourceApi.insert (package:googleapis/storage/v1.dart:3067:32)
#3      _MediaUploadStreamSink._startNormalUpload (package:gcloud/src/storage_impl.dart:599:10)
#4      new _MediaUploadStreamSink (package:gcloud/src/storage_impl.dart:514:9)
#5      _BucketImpl.write (package:gcloud/src/storage_impl.dart:179:16)
#6      uploadWithRetry.<anonymous closure> (package:pub_dev/shared/storage.dart:49:27)
<asynchronous suspension>
#7      retryAsync (package:pub_dev/shared/utils.dart:326:24)
<asynchronous suspension>
#8      uploadWithRetry (package:pub_dev/shared/storage.dart:47:9)
<asynchronous suspension>
#9      DartdocBackend.uploadDir.upload (package:pub_dev/dartdoc/backend.dart:131:13)
<asynchronous suspension>
#10     DartdocBackend.uploadDir.<anonymous closure> (package:pub_dev/dartdoc/backend.dart:143:64)
#11     Pool.withResource (package:pool/pool.dart:127:28)
<asynchronous suspension>
#12     DartdocBackend.uploadDir (package:pub_dev/dartdoc/backend.dart:143:39)
<asynchronous suspension>
#13     DartdocJobProcessor.process (package:pub_dev/dartdoc/dartdoc_runner.dart:225:30)
<asynchronous suspension>
#14     JobProcessor.run (package:pub_dev/job/job.dart:55:28)
<asynchronous suspension>
#15     JobMaintenance.run (package:pub_dev/job/job.dart:95:18)
#16     _workerMain.<anonymous closure> (package:pub_dev/service/entrypoint/dartdoc.dart:99:26)
#17     _asyncThenWrapperHelper.<anonymous closure> (dart:async-patch/async_patch.dart:71:64)
#18     StackZoneSpecification._registerUnaryCallback.<anonymous closure>.<anonymous closure> (package:stack_trace/src/stack_zone_specification.dart:129:26)
#19     StackZoneSpecification._run (package:stack_trace/src/stack_zone_specification.dart:209:15)
#20     StackZoneSpecification._registerUnaryCallback.<anonymous closure> (package:stack_trace/src/stack_zone_specification.dart:129:14)
#21     _rootRunUnary (dart:async/zone.dart:1132:38)
#22     _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#23     _FutureListener.handleValue (dart:async/future_impl.dart:137:18)
#24     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:678:45)
#25     Future._propagateToListeners (dart:async/future_impl.dart:707:32)
#26     Future._completeWithValue (dart:async/future_impl.dart:522:5)
#27     _AsyncAwaitCompleter.complete (dart:async-patch/async_patch.dart:30:15)
#28     _completeOnAsyncReturn (dart:async-patch/async_patch.dart:288:13)
#29     DartdocJobProcessor.generateDocsForSdk (package:pub_dev/dartdoc/dartdoc_runner.dart)
#30     _asyncThenWrapperHelper.<anonymous closure> (dart:async-patch/async_patch.dart:71:64)
#31     StackZoneSpecification._registerUnaryCallback.<anonymous closure>.<anonymous closure> (package:stack_trace/src/stack_zone_specification.dart:129:26)
#32     StackZoneSpecification._run (package:stack_trace/src/stack_zone_specification.dart:209:15)
#33     StackZoneSpecification._registerUnaryCallback.<anonymous closure> (package:stack_trace/src/stack_zone_specification.dart:129:14)
#34     _rootRunUnary (dart:async/zone.dart:1132:38)
#35     _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#36     _FutureListener.handleValue (dart:async/future_impl.dart:137:18)
#37     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:678:45)
#38     Future._propagateToListeners (dart:async/future_impl.dart:707:32)
#39     Future._completeWithValue (dart:async/future_impl.dart:522:5)
#40     _AsyncAwaitCompleter.complete (dart:async-patch/async_patch.dart:30:15)
#41     _completeOnAsyncReturn (dart:async-patch/async_patch.dart:288:13)
#42     VersionedJsonStorage.hasCurrentData (package:pub_dev/shared/storage.dart)
#43     _asyncThenWrapperHelper.<anonymous closure> (dart:async-patch/async_patch.dart:71:64)
#44     StackZoneSpecification._registerUnaryCallback.<anonymous closure>.<anonymous closure> (package:stack_trace/src/stack_zone_specification.dart:129:26)
#45     StackZoneSpecification._run (package:stack_trace/src/stack_zone_specification.dart:209:15)
#46     StackZoneSpecification._registerUnaryCallback.<anonymous closure> (package:stack_trace/src/stack_zone_specification.dart:129:14)
#47     _rootRunUnary (dart:async/zone.dart:1132:38)
#48     _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#49     _FutureListener.handleValue (dart:async/future_impl.dart:137:18)
#50     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:678:45)
#51     Future._propagateToListeners (dart:async/future_impl.dart:707:32)
#52     Future._completeWithValue (dart:async/future_impl.dart:522:5)
#53     _AsyncAwaitCompleter.complete (dart:async-patch/async_patch.dart:30:15)
#54     _completeOnAsyncReturn (dart:async-patch/async_patch.dart:288:13)
#55     ApiRequester.request (package:_discoveryapis_commons/src/clients.dart)
#56     _asyncThenWrapperHelper.<anonymous closure> (dart:async-patch/async_patch.dart:71:64)
#57     StackZoneSpecification._registerUnaryCallback.<anonymous closure>.<anonymous closure> (package:stack_trace/src/stack_zone_specification.dart:129:26)
#58     StackZoneSpecification._run (package:stack_trace/src/stack_zone_specification.dart:209:15)
#59     StackZoneSpecification._registerUnaryCallback.<anonymous closure> (package:stack_trace/src/stack_zone_specification.dart:129:14)
#60     _rootRunUnary (dart:async/zone.dart:1132:38)
#61     _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#62     _FutureListener.handleValue (dart:async/future_impl.dart:137:18)
#63     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:678:45)
#64     Future._propagateToListeners (dart:async/future_impl.dart:707:32)
#65     Future._complete (dart:async/future_impl.dart:512:7)
#66     Stream.join.<anonymous closure> (dart:async/stream.dart:840:18)
#67     StackZoneSpecification._run (package:stack_trace/src/stack_zone_specification.dart:209:15)
#68     StackZoneSpecification._registerCallback.<anonymous closure> (package:stack_trace/src/stack_zone_specification.dart:119:48)
#69     _rootRun (dart:async/zone.dart:1120:38)
#70     _CustomZone.run (dart:async/zone.dart:1021:19)
#71     _CustomZone.runGuarded (dart:async/zone.dart:923:7)
#72     _BufferingStreamSubscription._sendDone.sendDone (dart:async/stream_impl.dart:389:13)
#73     _BufferingStreamSubscription._sendDone (dart:async/stream_impl.dart:399:15)
#74     _BufferingStreamSubscription._close (dart:async/stream_impl.dart:283:7)
#75     _SinkTransformerStreamSubscription._close (dart:async/stream_transformers.dart:96:11)
#76     _EventSinkWrapper.close (dart:async/stream_transformers.dart:23:11)
#77     _StringAdapterSink.close (dart:convert/string_conversion.dart:249:11)
#78     _Utf8ConversionSink.close (dart:convert/string_conversion.dart:300:20)
#79     _ConverterStreamEventSink.close (dart:convert/chunked_conversion.dart:80:18)
#80     _SinkTransformerStreamSubscription._handleDone (dart:async/stream_transformers.dart:141:24)
#81     StackZoneSpecification._run (package:stack_trace/src/stack_zone_specification.dart:209:15)
#82     StackZoneSpecification._registerCallback.<anonymous closure> (package:stack_trace/src/stack_zone_specification.dart:119:48)
#83     _rootRun (dart:async/zone.dart:1120:38)
#84     _CustomZone.run (dart:async/zone.dart:1021:19)
#85     _CustomZone.runGuarded (dart:async/zone.dart:923:7)
#86     _BufferingStreamSubscription._sendDone.sendDone (dart:async/stream_impl.dart:389:13)
#87     _BufferingStreamSubscription._sendDone (dart:async/stream_impl.dart:399:15)
#88     _BufferingStreamSubscription._close (dart:async/stream_impl.dart:283:7)
#89     _ForwardingStream._handleDone (dart:async/stream_pipe.dart:106:10)
#90     _ForwardingStreamSubscription._handleDone (dart:async/stream_pipe.dart:172:13)
#91     StackZoneSpecification._run (package:stack_trace/src/stack_zone_specification.dart:209:15)
#92     StackZoneSpecification._registerCallback.<anonymous closure> (package:stack_trace/src/stack_zone_specification.dart:119:48)
#93     _rootRun (dart:async/zone.dart:1120:38)
#94     _CustomZone.run (dart:async/zone.dart:1021:19)
#95     _CustomZone.runGuarded (dart:async/zone.dart:923:7)
#96     _BufferingStreamSubscription._sendDone.sendDone (dart:async/stream_impl.dart:389:13)
#97     _BufferingStreamSubscription._sendDone (dart:async/stream_impl.dart:399:15)
#98     _BufferingStreamSubscription._close (dart:async/stream_impl.dart:283:7)
#99     _ForwardingStream._handleDone (dart:async/stream_pipe.dart:106:10)
#100    _ForwardingStreamSubscription._handleDone (dart:async/stream_pipe.dart:172:13)
#101    StackZoneSpecification._run (package:stack_trace/src/stack_zone_specification.dart:209:15)
#102    StackZoneSpecification._registerCallback.<anonymous closure> (package:stack_trace/src/stack_zone_specification.dart:119:48)
#103    _rootRun (dart:async/zone.dart:1120:38)
#104    _CustomZone.run (dart:async/zone.dart:1021:19)
#105    _CustomZone.runGuarded (dart:async/zone.dart:923:7)
#106    _BufferingStreamSubscription._sendDone.sendDone (dart:async/stream_impl.dart:389:13)
#107    _BufferingStreamSubscription._sendDone (dart:async/stream_impl.dart:399:15)
#108    _BufferingStreamSubscription._close (dart:async/stream_impl.dart:283:7)
#109    _SyncStreamControllerDispatch._sendDone (dart:async/stream_controller.dart:772:19)
#110    _StreamController._closeUnchecked (dart:async/stream_controller.dart:629:7)
#111    _StreamController.close (dart:async/stream_controller.dart:622:5)
#112    _HttpParser._closeIncoming (dart:_http/http_parser.dart:1037:23)
#113    _HttpParser._doParse (dart:_http/http_parser.dart:775:15)
#114    _HttpParser._parse (dart:_http/http_parser.dart:318:7)
#115    _HttpParser._onData (dart:_http/http_parser.dart:810:5)
#116    StackZoneSpecification._registerUnaryCallback.<anonymous closure>.<anonymous closure> (package:stack_trace/src/stack_zone_specification.dart:129:26)
#117    StackZoneSpecification._run (package:stack_trace/src/stack_zone_specification.dart:209:15)
#118    StackZoneSpecification._registerUnaryCallback.<anonymous closure> (package:stack_trace/src/stack_zone_specification.dart:129:14)
#119    _rootRunUnary (dart:async/zone.dart:1132:38)
#120    _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#121    _CustomZone.runUnaryGuarded (dart:async/zone.dart:931:7)
#122    _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:336:11)
#123    _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263:7)
#124    _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:764:19)
#125    _StreamController._add (dart:async/stream_controller.dart:640:7)
#126    _StreamController.add (dart:async/stream_controller.dart:586:5)
#127    _Socket._onData (dart:io-patch/socket_patch.dart:1829:41)
#128    StackZoneSpecification._registerUnaryCallback.<anonymous closure>.<anonymous closure> (package:stack_trace/src/stack_zone_specification.dart:129:26)
#129    StackZoneSpecification._run (package:stack_trace/src/stack_zone_specification.dart:209:15)
#130    StackZoneSpecification._registerUnaryCallback.<anonymous closure> (package:stack_trace/src/stack_zone_specification.dart:129:14)
#131    _rootRunUnary (dart:async/zone.dart:1132:38)
#132    _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#133    _CustomZone.runUnaryGuarded (dart:async/zone.dart:931:7)
#134    _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:336:11)
#135    _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263:7)
#136    _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:764:19)
#137    _StreamController._add (dart:async/stream_controller.dart:640:7)
#138    _StreamController.add (dart:async/stream_controller.dart:586:5)
#139    _RawSecureSocket._sendReadEvent (dart:io/secure_socket.dart:1016:19)
#140    StackZoneSpecification._run (package:stack_trace/src/stack_zone_specification.dart:209:15)
#141    StackZoneSpecification._registerCallback.<anonymous closure> (package:stack_trace/src/stack_zone_specification.dart:119:48)
#142    _rootRun (dart:async/zone.dart:1120:38)
#143    _CustomZone.run (dart:async/zone.dart:1021:19)
#144    _CustomZone.runGuarded (dart:async/zone.dart:923:7)
#145    _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:963:23)
#146    StackZoneSpecification._run (package:stack_trace/src/stack_zone_specification.dart:209:15)
#147    StackZoneSpecification._registerCallback.<anonymous closure> (package:stack_trace/src/stack_zone_specification.dart:119:48)
#148    _rootRun (dart:async/zone.dart:1124:13)
#149    _CustomZone.run (dart:async/zone.dart:1021:19)
#150    _CustomZone.bindCallback.<anonymous closure> (dart:async/zone.dart:947:23)
#151    Timer._createTimer.<anonymous closure> (dart:async-patch/timer_patch.dart:21:15)
#152    _Timer._runTimers (dart:isolate-patch/timer_impl.dart:382:19)
#153    _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:416:5)
#154    _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:172:12)

The package description is too short. (-12 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.8
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test