Skip to content

Commit 2446a32

Browse files
authored
Update README.md - Multi-segment linear indicator section (#229)
1 parent f390f4c commit 2446a32

File tree

1 file changed

+72
-35
lines changed

1 file changed

+72
-35
lines changed

README.md

Lines changed: 72 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -307,13 +307,21 @@ Basic Widget
307307
new MultiSegmentLinearIndicator(
308308
width: MediaQuery.of(context).size.width - 64,
309309
lineHeight: 30.0,
310-
firstSegmentPercent: 0.25,
311-
secondSegmentPercent: 0.4,
312-
thirdSegmentPercent: 0.35,
313-
firstSegmentColor: Color(0xFF4285F4),
314-
secondSegmentColor: Color(0xFF6DD5F6),
315-
thirdSegmentColor: Color(0xFFEFEFEF),
316-
enableStripes: [1],
310+
segments: [
311+
SegmentLinearIndicator(
312+
percent: 0.25,
313+
color: Color(0xFF4285F4),
314+
enableStripes: true,
315+
),
316+
SegmentLinearIndicator(
317+
percent: 0.4,
318+
color: Color(0xFF6DD5F6),
319+
),
320+
SegmentLinearIndicator(
321+
percent: 0.35,
322+
color: Color(0xFFEFEFEF),
323+
),
324+
],
317325
barRadius: Radius.circular(10.0),
318326
animation: true,
319327
animationDuration: 1000,
@@ -349,13 +357,21 @@ Complete example
349357
MultiSegmentLinearIndicator(
350358
width: MediaQuery.of(context).size.width - 64,
351359
lineHeight: 30.0,
352-
firstSegmentPercent: 0.25,
353-
secondSegmentPercent: 0.4,
354-
thirdSegmentPercent: 0.35,
355-
firstSegmentColor: Color(0xFF4285F4),
356-
secondSegmentColor: Color(0xFF6DD5F6),
357-
thirdSegmentColor: Color(0xFFEFEFEF),
358-
enableStripes: [1],
360+
segments: [
361+
SegmentLinearIndicator(
362+
percent: 0.25,
363+
color: Color(0xFF4285F4),
364+
enableStripes: true,
365+
),
366+
SegmentLinearIndicator(
367+
percent: 0.4,
368+
color: Color(0xFF6DD5F6),
369+
),
370+
SegmentLinearIndicator(
371+
percent: 0.35,
372+
color: Color(0xFFEFEFEF),
373+
),
374+
],
359375
barRadius: Radius.circular(10.0),
360376
animation: true,
361377
animationDuration: 1000,
@@ -379,13 +395,21 @@ Complete example
379395
MultiSegmentLinearIndicator(
380396
width: MediaQuery.of(context).size.width - 40,
381397
lineHeight: 20.0,
382-
firstSegmentPercent: 0.3,
383-
secondSegmentPercent: 0.4,
384-
thirdSegmentPercent: 0.3,
385-
firstSegmentColor: Color(0xFFBA0521),
386-
secondSegmentColor: Color(0xFF071437),
387-
thirdSegmentColor: Color(0xFFFF9205),
388-
enableStripes: [2],
398+
segments: [
399+
SegmentLinearIndicator(
400+
percent: 0.3,
401+
color: Color(0xFFBA0521),
402+
),
403+
SegmentLinearIndicator(
404+
percent: 0.4,
405+
color: Color(0xFF071437),
406+
enableStripes: true,
407+
),
408+
SegmentLinearIndicator(
409+
percent: 0.3,
410+
color: Color(0xFFFF9205),
411+
),
412+
],
389413
barRadius: Radius.circular(20),
390414
),
391415
SizedBox(height: 10),
@@ -397,13 +421,22 @@ Complete example
397421
MultiSegmentLinearIndicator(
398422
width: MediaQuery.of(context).size.width - 40,
399423
lineHeight: 20.0,
400-
firstSegmentPercent: firstSegment,
401-
secondSegmentPercent: secondSegment,
402-
thirdSegmentPercent: thirdSegment,
403-
firstSegmentColor: Colors.green,
404-
secondSegmentColor: Colors.blue,
405-
thirdSegmentColor: Colors.orange,
406-
enableStripes: [1, 3],
424+
segments: [
425+
SegmentLinearIndicator(
426+
percent: firstSegment,
427+
color: Colors.green,
428+
enableStripes: true,
429+
),
430+
SegmentLinearIndicator(
431+
percent: secondSegment,
432+
color: Colors.blue,
433+
enableStripes: true,
434+
),
435+
SegmentLinearIndicator(
436+
percent: thirdSegment,
437+
color: Colors.orange,
438+
),
439+
],
407440
animation: true,
408441
animateFromLastPercent: true,
409442
animationDuration: 1000,
@@ -419,13 +452,17 @@ Complete example
419452
MultiSegmentLinearIndicator(
420453
width: MediaQuery.of(context).size.width - 64,
421454
lineHeight: 30.0,
422-
firstSegmentPercent: 0.15,
423-
secondSegmentPercent: 0.4,
424-
thirdSegmentPercent: 0.45,
425-
firstSegmentColor: Color(0xFFBA0521),
426-
secondSegmentColor: Color(0xFFAEFAB00),
427-
thirdSegmentColor: Color(0xFFEFEFEF),
428-
enableStripes: [1],
455+
segments: [
456+
SegmentLinearIndicator(
457+
percent: 0.15,
458+
color: Color(0xFFBA0521),
459+
enableStripes: true,
460+
),
461+
SegmentLinearIndicator(
462+
percent: 0.4, color: Color(0xFFAEFAB00)),
463+
SegmentLinearIndicator(
464+
percent: 0.45, color: Color(0xFFEFEFEF)),
465+
],
429466
animation: true,
430467
animationDuration: 1000,
431468
curve: Curves.decelerate,

0 commit comments

Comments
 (0)