@@ -59,7 +59,7 @@ class _LayoutPageState extends State<LayoutPage> {
5959 @override
6060 Widget build (BuildContext context) {
6161 if (isInitState) {
62- SchedulerBinding .instance? .addPostFrameCallback ((_) {
62+ SchedulerBinding .instance.addPostFrameCallback ((_) {
6363 isInitState = false ;
6464 });
6565 }
@@ -240,7 +240,8 @@ class _LayoutPageState extends State<LayoutPage> {
240240 'images/git_hub_mobile.png' ,
241241 color: Colors .white),
242242 onPressed: () {
243- launch (currentSample! .codeLink! );
243+ launchUrl (Uri .parse (
244+ currentSample! .codeLink! ));
244245 },
245246 ),
246247 ),
@@ -326,36 +327,36 @@ class _LayoutPageState extends State<LayoutPage> {
326327
327328 /// Get tabs which length is equal to list length
328329 List <Widget > _getTabs (List <SubItem > list, [String ? tabView]) {
329- final List <Widget > _tabs = < Widget > [];
330- String _status ;
330+ final List <Widget > tabs = < Widget > [];
331+ String status ;
331332 for (int i = 0 ; i < list.length; i++ ) {
332333 if (list.isNotEmpty) {
333- _status = getStatusTag (list[i]);
334- _tabs .add (Tab (
334+ status = getStatusTag (list[i]);
335+ tabs .add (Tab (
335336 child: Row (
336337 children: < Widget > [
337- Text (list[i].title.toString () + (_status != '' ? ' ' : '' ),
338+ Text (list[i].title.toString () + (status != '' ? ' ' : '' ),
338339 style: tabView != 'parent'
339340 ? const TextStyle (
340341 fontSize: 14 , fontWeight: FontWeight .normal)
341342 : const TextStyle (fontSize: 15 , color: Colors .white)),
342- if (_status == '' )
343+ if (status == '' )
343344 Container ()
344345 else
345346 Container (
346347 height: tabView != 'parent' ? 17 : 20 ,
347348 width: tabView != 'parent' ? 17 : 20 ,
348349 decoration: BoxDecoration (
349- color: _status == 'N'
350+ color: status == 'N'
350351 ? const Color .fromRGBO (55 , 153 , 30 , 1 )
351- : _status == 'U'
352+ : status == 'U'
352353 ? const Color .fromRGBO (246 , 117 , 0 , 1 )
353354 : Colors .transparent,
354355 shape: BoxShape .circle,
355356 ),
356357 alignment: Alignment .center,
357358 child: Text (
358- _status ,
359+ status ,
359360 style: TextStyle (
360361 fontSize: tabView != 'parent' ? 11 : 12 ,
361362 color: Colors .white),
@@ -365,32 +366,32 @@ class _LayoutPageState extends State<LayoutPage> {
365366 )));
366367 }
367368 }
368- return _tabs ;
369+ return tabs ;
369370 }
370371
371372 /// To displaying sample in full screen height,
372373 /// it doesn't contains expanded view.
373374 List <Widget > _getFullViewSamples (SampleModel model, List <SubItem > list) {
374- final List <Widget > _tabs = < Widget > [];
375- SubItem _sampleDetail ;
376- bool _needsFloatingBotton ;
375+ final List <Widget > tabs = < Widget > [];
376+ SubItem sampleDetail ;
377+ bool needsFloatingBotton ;
377378 for (int j = 0 ; j < list.length; j++ ) {
378- _sampleDetail = list[j];
379- _needsFloatingBotton = (_sampleDetail.sourceLink != null &&
380- _sampleDetail .sourceLink != '' ) ||
381- _sampleDetail .needsPropertyPanel == true ;
382- final Function ? _sampleWidget = model.sampleWidget[list[j].key];
383- final SampleView _sampleView =
384- _sampleWidget !(GlobalKey <State >()) as SampleView ;
379+ sampleDetail = list[j];
380+ needsFloatingBotton =
381+ (sampleDetail.sourceLink != null && sampleDetail .sourceLink != '' ) ||
382+ (sampleDetail .needsPropertyPanel ?? false ) ;
383+ final Function ? sampleWidget = model.sampleWidget[list[j].key];
384+ final SampleView sampleView =
385+ sampleWidget !(GlobalKey <State >()) as SampleView ;
385386
386- _tabs .add (
387+ tabs .add (
387388 Scaffold (
388389 backgroundColor: model.cardThemeColor,
389- body: _sampleView ,
390- floatingActionButton: _needsFloatingBotton
390+ body: sampleView ,
391+ floatingActionButton: needsFloatingBotton
391392 ? Stack (children: < Widget > [
392- if (_sampleDetail .sourceLink != null &&
393- _sampleDetail .sourceLink != '' )
393+ if (sampleDetail .sourceLink != null &&
394+ sampleDetail .sourceLink != '' )
394395 Align (
395396 alignment: Alignment .bottomLeft,
396397 child: Container (
@@ -399,13 +400,14 @@ class _LayoutPageState extends State<LayoutPage> {
399400 height: 30 ,
400401 width: 230 ,
401402 child: InkWell (
402- onTap: () => launch (_sampleDetail.sourceLink! ),
403+ onTap: () =>
404+ launchUrl (Uri .parse (sampleDetail.sourceLink! )),
403405 child: Row (
404406 children: < Widget > [
405407 Text ('Source: ' ,
406408 style: TextStyle (
407409 fontSize: 16 , color: model.textColor)),
408- Text (_sampleDetail .sourceText! ,
410+ Text (sampleDetail .sourceText! ,
409411 style: const TextStyle (
410412 fontSize: 14 , color: Colors .blue)),
411413 ],
@@ -416,20 +418,20 @@ class _LayoutPageState extends State<LayoutPage> {
416418 )
417419 else
418420 Container (),
419- if (_sampleDetail .needsPropertyPanel != true )
421+ if (sampleDetail .needsPropertyPanel != true )
420422 Container ()
421423 else
422424 Align (
423425 alignment: Alignment .bottomRight,
424426 child: FloatingActionButton (
425427 heroTag: null ,
426428 onPressed: () {
427- final GlobalKey _sampleKey =
428- _sampleView .key! as GlobalKey ;
429- final Widget _settingsContent =
430- _getSettingsView (_sampleKey )! ;
429+ final GlobalKey sampleKey =
430+ sampleView .key! as GlobalKey ;
431+ final Widget settingsContent =
432+ _getSettingsView (sampleKey )! ;
431433 showBottomSheetSettingsPanel (
432- context, _settingsContent );
434+ context, settingsContent );
433435 },
434436 backgroundColor: model.paletteColor,
435437 child:
@@ -442,7 +444,7 @@ class _LayoutPageState extends State<LayoutPage> {
442444 );
443445 }
444446
445- return _tabs ;
447+ return tabs ;
446448 }
447449
448450 Widget ? _getSettingsView (GlobalKey sampleKey) {
@@ -453,7 +455,7 @@ class _LayoutPageState extends State<LayoutPage> {
453455 final bool isDirectionalitySample =
454456 sampleKey.currentState! is DirectionalitySampleViewState ;
455457 if (isLocalizationSample || isDirectionalitySample) {
456- return ListView (children: < Widget > [
458+ return ListView (shrinkWrap : true , children: < Widget > [
457459 (sampleKey.currentState! as LocalizationSampleViewState )
458460 .localizationSelectorWidget (context),
459461 if (isDirectionalitySample)
@@ -462,26 +464,25 @@ class _LayoutPageState extends State<LayoutPage> {
462464 else
463465 Container (),
464466 sampleState.buildSettings (context) ?? Container ()
465- ], shrinkWrap : true );
467+ ]);
466468 } else {
467469 return sampleState.buildSettings (context);
468470 }
469471 }
470472
471473 /// To displaying sample in cards, it contains expanded sample view option.
472474 List <Widget > _getCardViewSamples (SampleModel model, List <SubItem > list) {
473- final List <Widget > _tabChildren = < Widget > [];
474- Function _sampleWidget ;
475- SampleView _sampleView ;
475+ final List <Widget > tabChildren = < Widget > [];
476+ Function sampleWidget ;
477+ SampleView sampleView ;
476478 for (int i = 0 ; i < list.length; i++ ) {
477- _tabChildren .add (ListView .builder (
479+ tabChildren .add (ListView .builder (
478480 cacheExtent: (list.length).toDouble (),
479- addAutomaticKeepAlives: true ,
480481 itemCount: list.length,
481482 itemBuilder: (BuildContext context, int position) {
482- final String ? _status = list[position].status;
483- _sampleWidget = model.sampleWidget[list[position].key]! ;
484- _sampleView = _sampleWidget (GlobalKey <State >()) as SampleView ;
483+ final String ? status = list[position].status;
484+ sampleWidget = model.sampleWidget[list[position].key]! ;
485+ sampleView = sampleWidget (GlobalKey <State >()) as SampleView ;
485486
486487 return Container (
487488 color: model.themeData.colorScheme.brightness == Brightness .dark
@@ -528,25 +529,24 @@ class _LayoutPageState extends State<LayoutPage> {
528529 children: < Widget > [
529530 Container (
530531 decoration: BoxDecoration (
531- color: (_status != null && _status != '' )
532- ? (_status == 'New' ||
533- _status == 'new'
532+ color: (status != null && status != '' )
533+ ? (status == 'New' ||
534+ status == 'new'
534535 ? const Color .fromRGBO (
535536 55 , 153 , 30 , 1 )
536537 : const Color .fromRGBO (
537538 246 , 117 , 0 , 1 ))
538539 : Colors .transparent,
539- shape: BoxShape .rectangle,
540540 borderRadius: const BorderRadius .all (
541541 Radius .circular (10.0 ))),
542542 padding: const EdgeInsets .fromLTRB (
543543 5 , 2.7 , 5 , 2.7 ),
544544 child: Text (
545- (_status == 'New' ||
546- _status == 'new' )
545+ (status == 'New' ||
546+ status == 'new' )
547547 ? 'New'
548- : (_status == 'Updated' ||
549- _status == 'updated' )
548+ : (status == 'Updated' ||
549+ status == 'updated' )
550550 ? 'Updated'
551551 : '' ,
552552 style: const TextStyle (fontSize: 12 , color: Colors .white))),
@@ -578,7 +578,7 @@ class _LayoutPageState extends State<LayoutPage> {
578578 child: SizedBox (
579579 width: double .infinity,
580580 height: 230 ,
581- child: _sampleView ),
581+ child: sampleView ),
582582 ),
583583 ],
584584 ),
@@ -589,15 +589,15 @@ class _LayoutPageState extends State<LayoutPage> {
589589 }));
590590 }
591591
592- return _tabChildren ;
592+ return tabChildren ;
593593 }
594594
595595 /// If child type given to control subitems.
596596 List <Widget > _getChildTabViewChildren (SampleModel model, List <SubItem > list) {
597- final List <Widget > _tabs = < Widget > [];
597+ final List <Widget > tabs = < Widget > [];
598598 for (int i = 0 ; i < list.length; i++ ) {
599599 if (list[i].subItems! .isNotEmpty) {
600- _tabs .add (Container (
600+ tabs .add (Container (
601601 alignment: Alignment .center,
602602 child: DefaultTabController (
603603 length: list[i].subItems! .length,
@@ -641,16 +641,16 @@ class _LayoutPageState extends State<LayoutPage> {
641641 ));
642642 }
643643 }
644- return _tabs ;
644+ return tabs ;
645645 }
646646
647647 /// If parent type given to control's subitem.
648648 List <Widget > _getParentTabViewChildren (
649649 SampleModel model, List <SubItem > list) {
650- final List <Widget > _tabs = < Widget > [];
650+ final List <Widget > tabs = < Widget > [];
651651 for (int i = 0 ; i < list.length; i++ ) {
652652 if (list[i].subItems! .isNotEmpty) {
653- _tabs .add (Container (
653+ tabs .add (Container (
654654 alignment: Alignment .center,
655655 child: DefaultTabController (
656656 length: list[i].subItems! .length,
@@ -710,7 +710,7 @@ class _LayoutPageState extends State<LayoutPage> {
710710 }
711711 }
712712
713- return _tabs ;
713+ return tabs ;
714714 }
715715
716716 @override
0 commit comments