---
# System prepended metadata

title: Software Studio Lab 4

---

# Software Studio Lab 4
```=
// import 'dart:js';

import 'dart:ffi';

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

class ExpandedPage extends StatefulWidget {
  ExpandedPage({super.key});

  @override
  State<ExpandedPage> createState() => _ExpandedPageState();
}

class _ExpandedPageState extends State<ExpandedPage> with TickerProviderStateMixin {

  late PageController _pageViewController;
  int _currentPageIndex = 0;
  
  double icon1Mov = 0;
  double icon2Mov = 0;
  double text1Mov = 0;
  double text2Mov = 0;
  double button1Mov = 0;
  double button2Mov = 0;

   @override
  void initState() {
  
    super.initState();
    
    _pageViewController = PageController();
    
    _pageViewController.addListener(() {
      var offset = _pageViewController.offset;
      var pageBox = context.findRenderObject() as RenderBox;
      var width = pageBox.size.width;
      setState(() {
        icon1Mov = 0 - offset;
        text1Mov = 0 - 1.5 * offset;
        button1Mov = 0 - 2.5 * offset;
        icon2Mov = width - offset;
        text2Mov = 1.5 * width - 1.5 * offset;
        button2Mov = 2.5 * width - 2.5 * offset;
      });
      
    });
  }

  @override
  void dispose() {
    super.dispose();
    _pageViewController.dispose();
  }

  ...

  @override
  Widget build(BuildContext context) {
    final isDarkMode =
        MediaQuery.of(context).platformBrightness == Brightness.dark;

    ...
              Transform.translate(
                offset: Offset(icon1Mov, 0),
                ...
              ),
              const SizedBox(height: 40,),
              Transform.translate(
                offset: Offset(text1Mov, 0),
                ...
              ),
              const SizedBox(height: 40,),
              Transform.translate(
                offset: Offset(button1Mov, 0),
                ...
              ),
                
                ...
                
              Transform.translate(
                offset: Offset(icon2Mov, 0),
                ...
              ),
              const SizedBox(height: 40,),
              Transform.translate(
                offset: Offset(text2Mov, 0),
                ...
              ),
              const SizedBox(height: 40,),
              Transform.translate(
                offset: Offset(button2Mov, 0),
                ...
              ),
            
            ...
```